RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make a light flicker when monster is nearby with magnitude"
-- local script local part = script.Parent local monster = game.Workspace.Monster local canFlicker = true local function flicker(otherPart) local magnitude = (part.Position - monster.Position).magnitude if canFlicker and magnitude < 10 then canFlicker = false while magnitude < 10 do part.Light.Enabled = not part.Light.Enabled wait(0.2) magnitude = (part.Position - monster.Position).magnitude end part.Light.Enabled = true canFlicker = true end end part.Touched:Connect(flicker)