So in this game I am making, there is a giant microwave that players can walk into. The microwave runs on 10 second intermission so everyone who wants to get in can get in in time. Once the 10 seconds is over, the door of the microwave closes, the player's skins turn red, then the door opens up and flings the players in the microwave out of the microwave. Then it repeats.
The problem is that it doesn't seem to go through the whole script, and it appears to count down to 10, close the door and open the door in a matter of seconds. There is no skin color-changing or players flinging. What do I do?
I tried putting print functions and it appears to stop going through the function right before this for loop:
for i, v in pairs(InterPlayers)do
but I am confused because if it doesn't go through, then shouldn't it stop working? Rather it just keeps looping through the beginning of the script as if nothing is after it.
Here is the whole script:
local billboard = script.Parent.Parent.BillboardGui.Frame.TextLabel
local waittime = 11
script.Parent.PrimaryPart = script.Parent.Pivot
local TableI = script.Parent.Parent.Tableimporter
for i = 1,10 do
script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame()*CFrame.fromEulerAnglesXYZ(0,-.15,0))
wait()
end
while true do
billboard.Text = waittime
for i = 1,11 do
waittime = waittime - 1
billboard.Text = waittime
wait(1)
end
for i = 1,10 do
script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame()*CFrame.fromEulerAnglesXYZ(0,.15,0))
wait()
end
if waittime <= 0 then
billboard.Text = ""
local InterPlayers = TableI:GetTouchingParts()
for i, v in pairs(InterPlayers)do
if v:FindFirstChild("Humanoid") then
for i = 1,10 do
v.UpperTorso.Color = v.UpperTorso.Color + Color3.new(10,-10,-10)
v.LowerTorso.Color = v.LowerTorso.Color + Color3.new(10,-10,-10)
v.LeftUpperArm.Color = v.LeftUpperArm.Color + Color3.new(10,-10,-10)
v.LeftLowerArm.Color = v.LeftLowerArm.Color + Color3.new(10,-10,-10)
v.LeftHand.Color = v.LeftHand.Color + Color3.new(10,-10,-10)
v.RightHand.Color = v.RightHand.Color + Color3.new(10,-10,-10)
v.RightUpperArm.Color = v.RightUpperArm.Color + Color3.new(10,-10,-10)
v.RightLowerArm.Color = v.RightLowerArm.Color + Color3.new(10,-10,-10)
v.RightUpperLeg.Color = v.RightUpperLeg.Color + Color3.new(10,-10,-10)
v.RightLowerLeg.Color = v.RightLowerLeg.Color + Color3.new(10,-10,-10)
v.RightFoot.Color = v.RightFoot.Color + Color3.new(10,-10,-10)
v.LeftLowerLeg.Color = v.LeftLowerArm.Color + Color3.new(10,-10,-10)
v.LeftUpperLeg.Color = v.LeftUpperLeg.Color + Color3.new(10,-10,-10)
v.LeftFoot.Color = v.LeftFoot.Color + Color3.new(10,-10,-10)
v.Head.Color = v.Head.Color + Color3.new(10,-10,-10)
wait(.5)
end
end
end
for i = 1,10 do
script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame()*CFrame.fromEulerAnglesXYZ(0,-.15,0))
wait()
end
for i, v in pairs(InterPlayers)do
if v:FindFirstChild("Humanoid") then
v.Humanoid.PerformStand = true
v.HumanoidRootPart.Velocity = v.HumanoidRootPart.Velocity + Vector3(300,0,0)
end
end
InterPlayers = {}
wait(3)
waittime = 11
end
end
