I want to blink then turn off all the lights when you touch a part on the floor.
This is what the workspace looks like for a better understanding
Model Script Lights Part SpotLight Part SpotLight Hit (The part that you touch)
This is the script to turn the lights off
local part = script.Parent local Light = script.Parent.Lights:GetDescendants("SpotLight") local hit = script.Parent.Hit local function onPartTouched(hit) hit.CanTouch = false Light.Enabled = false wait(.2) Light.Enabled = true wait(.1) Light.Enabled = false wait(.2) Light.Enabled = true wait(.2) Light.Enabled = false end hit.Touched:Connect(onPartTouched)
Use a 'for loop'.
This function turns all lights on/off at once.
local function lights(bool) for _, v in pairs(Light) do v.Enabled = bool end end
Then, you can call this function in onPartTouched() :
lights(false) wait(.2) lights(true) wait(.1) lights(false) wait(.2) lights(true) wait(.2) lights(false)