Hello, I am making a new game. I want to spin the Bottle. I think i am corret but this script isn't working.Can i get an help?
part = script.Parent a = 0 local pigs pigs = 1 while pigs do part.Orientation.Y = part.Orientation.Y + 0.01 wait(0.001) end pigs = 0 b = math.random(0,15) wait(b) local playing = false while playing do if playing == false then waittime = math.random(0,10) part.Orientation = Vector3.new(0,1,0) - Vector3.new(0,1,0) wait(waittime) playing = true end end
Here is the Error.
14:20:09.192 - Stack Begin
14:20:09.192 - Script 'Workspace.Sise.SpinScript', Line 6
14:20:09.193 - Stack End
Use Vector3 instead, not it's axis.
part = script.Parent a = 0 local pigs pigs = 1 while pigs do part.Orientation = part.Orientation + Vector3.new(0,0.1,0) wait() end pigs = 0 b = math.random(0,15) wait(b) local playing = false while playing do if playing == false then waittime = math.random(0,10) part.Orientation = part.Orientation - Vector3.new(0,1,0) wait(waittime) playing = true end end
I tested the code from outside the stack, and the error:
Y cannot be assigned to
Either do this:
while pigs do part.Orientation = Vector3.new(part.Orientation.X, (part.Orientation.Y + 0.01), part.Orientation.Z) wait(0.001) end
or for some reason "part" becomes nil in the process