The following is a very simple script, but always crashes my game when I test it. Why?
while true do script.Parent.SpotLight.Angle = script.Parent.SpotLight.Angle +5 end
I cannot tell you why, but games always crash when you do not wait before ending a infinite loop. This may be because it's loops an infinite amount of times and it's too much to handle/too fast. To fix this, just add a wait before the end.
while true do script.Parent.SpotLight.Angle = script.Parent.SpotLight.Angle +5 wait() --I prefer wait() unless you would like to use wait(1), depending on how fast you want it to add 5 to the angle. end