I am using lights i found on roblox and I want to make them move one way then after they move to move a different way right after. I have the functions keybind so I want to just press my key and make the movements happen one after the other. Anyone know what I need to edit?

function script.MoveTest.OnServerInvoke()
	for i,v in pairs (game.Workspace.MLights:GetChildren())
	do
		if v.Name == "CPSS"
		then
			v.LightingController.Tilt:Invoke(90)
			v.LightingController.Pan:Invoke(90)
		elseif v.Name == "CPSSa"
		then
			v.LightingController.Tilt:Invoke(-90)
			v.LightingController.Pan:Invoke(-90)
		end
	end
end

function script.MoveTest.OnServerInvoke()
	for i,v in pairs (game.Workspace.MLights:GetChildren())
	do
		if v.Name == "CPSS"
		then
			v.LightingController.Tilt:Invoke(0)
			v.LightingController.Pan:Invoke(0)
		elseif v.Name == "CPSSa"
		then
			v.LightingController.Tilt:Invoke(0)
			v.LightingController.Pan:Invoke(0)
		end
	end
end

1 comment

0

Try using while true do, it's a loop command that loops whatever is inside it.