Pixel.Dead.Value.Enabled
is the bool value inside the pixel frame, when the function is called and the bool value is enabled, it should do the death animation..
It may be because I am doing this inside the function. Is it? If so what should I do? If not what is wrong?
while true do wait(0.1) Pixel.Rotation = Pixel.Rotation + 50 end
The script
local Pixel = script.Parent.Pixel function die() if Pixel.Dead.Value.Enabled == true then while true do wait(0.1) Pixel.Rotation = Pixel.Rotation + 50 end wait(0.5) Pixel:TweenPosition(UDim2.new(Pixel.Position.X.Scale,Pixel.Position.X.Offset,Pixel.Position.Y.Scale,Pixel.Position.Y.Offset-500),"Out","Quad",.5) Pixel.Rotation = 0 --Reset rotation Pixel.Position = {0.5,-284},{0.5,201} --Start position, may need to find another method if we are doing levels. Pixel.Dead.Value.Enabled = false --Reset value end end
EDIT
local Pixel = script.Parent.Pixel function die() if Pixel.Dead.Value.Enabled == true then for i=1,0, +50 do wait(0.1) Pixel.Rotation = Pixel.Rotation = i end Pixel:TweenPosition(UDim2.new(Pixel.Position.X.Scale,Pixel.Position.X.Offset,Pixel.Position.Y.scale,Pixel.Position.Y.Offset-500),"Out","Quad",.5) pixel.Rotation = 0 --Reset rotation Pixel.Position = {0.5,-284},{0.5,201} --Start position, may need to find another method if we are doing levels. Pixel.Dead.Value.Enabled = false --Reset value end end end)
The Problem is you have a non-terminating while loop. The loop never ends so your script never gets passed it. I'd change it to a For loop to loop for a certain amount of time before moving on to the second part of your script.