I’m having a weird issue with my script. It’s erroring, saying the following:
local events = replicatedStorage:FindFirstChild("RemoteEvents")
local jpEvent = events["Jumpscare"]
local requestMove = events["TYRequestMove"]
local requestMoveClient = events["RequestMove"]
local checkersModel = workspace:FindFirstChild("ToyCheckers")
local turnedOn = false
local serverStorage = game:GetService("ServerStorage")
local waitTimes = {"30", "20", "25", "15", "35", "10", "5"}
requestMove.OnServerEvent:Connect(function(Player,Animatronic)
turnedOn = true
end)
function playAnimationChecker(what)
if what == "Stage" then
local model = workspace["ToyCheckers"]
local animator = model["Humanoid"].Animator
local animation = animator:LoadAnimation(model.Idle)
animation:Play()
end
end
playAnimationChecker("Stage")
function moveCheckers(where)
if where == "Diner" then
local model = serverStorage["ToyCheckerPositions"].Dinercheckerpose:Clone()
model.Name = "ToyCheckers"
local animatorD = model["Humanoid"]:WaitForChild("Animator")
local animationD = animatorD:LoadAnimation(model:FindFirstChild("Idle"))
animationD:Play()
if workspace:FindFirstChild("ToyCheckers") then
workspace["ToyCheckers"].Parent = serverStorage
end
model.Parent = workspace
requestMoveClient:FireAllClients("ToyCheckers")
elseif where == "FartherDiner" then
local model = serverStorage["ToyCheckerPositions"].FDinercheckerpose:Clone()
model.Name = "ToyCheckers"
if workspace:FindFirstChild("ToyCheckers") then
workspace["ToyCheckers"].Parent = serverStorage
end
model.Parent = workspace
requestMoveClient:FireAllClients("ToyCheckers")
elseif where == "PrizeCorner" then
local model = serverStorage["ToyCheckerPositions"].PCcheckerpose:Clone()
model.Name = "ToyCheckers"
local animator = model["Humanoid"].Animator
local animation = animator:LoadAnimation(model.Idle)
animation:Play()
if workspace:FindFirstChild("ToyCheckers") then
workspace["ToyCheckers"].Parent = serverStorage
end
model.Parent = workspace
requestMoveClient:FireAllClients("ToyCheckers")
elseif where == "Hallway" then
local model = serverStorage["ToyCheckerPositions"].PRHDcheckerpose:Clone()
model.Name = "ToyCheckers"
if workspace:FindFirstChild("ToyCheckers") then
workspace["ToyCheckers"].Parent = serverStorage
end
model.Parent = workspace
requestMoveClient:FireAllClients("ToyCheckers")
elseif where == "FartherHallway" then
local model = serverStorage["ToyCheckerPositions"].FPRHDicheckerpose:Clone()
model.Name = "ToyCheckers"
if workspace:FindFirstChild("ToyCheckers") then
workspace["ToyCheckers"].Parent = serverStorage
end
model.Parent = workspace
requestMoveClient:FireAllClients("ToyCheckers")
elseif where == "FrontHall" then
local model = serverStorage["ToyCheckerPositions"].PASDcheckerpose:Clone()
model.Name = "ToyCheckers"
if workspace:FindFirstChild("ToyCheckers") then
workspace["ToyCheckers"].Parent = serverStorage
end
model.Parent = workspace
requestMoveClient:FireAllClients("ToyCheckers")
elseif where == "EastHall" then
local model = serverStorage["ToyCheckerPositions"].EHcheckerpose:Clone()
model.Name = "ToyCheckers"
if workspace:FindFirstChild("ToyCheckers") then
workspace["ToyCheckers"].Parent = serverStorage
end
model.Parent = workspace
requestMoveClient:FireAllClients("ToyCheckers")
elseif where == "FartherEastHall" then
local model = serverStorage["ToyCheckerPositions"].FEHcheckerpose:Clone()
model.Name = "ToyCheckers"
if workspace:FindFirstChild("ToyCheckers") then
workspace["ToyCheckers"].Parent = serverStorage
end
model.Parent = workspace
requestMoveClient:FireAllClients("ToyCheckers")
elseif where == "Door" then
local model = serverStorage["ToyCheckerPositions"].Dcheckerpose:Clone()
model.Name = "ToyCheckers"
if workspace:FindFirstChild("ToyCheckers") then
workspace["ToyCheckers"].Parent = serverStorage
end
model.Parent = workspace
requestMoveClient:FireAllClients("ToyCheckers")
end
end
while wait() do
if turnedOn == true then
local waitTimeResult = waitTimes[math.random(1,#waitTimes)]
wait(waitTimeResult)
moveCheckers("Diner")
local waitTimeResult = waitTimes[math.random(1,#waitTimes)]
wait(waitTimeResult)
moveCheckers("FartherDiner")
local waitTimeResult = waitTimes[math.random(1,#waitTimes)]
wait(waitTimeResult)
moveCheckers("PrizeCorner")
local waitTimeResult = waitTimes[math.random(1,#waitTimes)]
wait(waitTimeResult)
moveCheckers("Hallway")
local waitTimeResult = waitTimes[math.random(1,#waitTimes)]
wait(waitTimeResult)
moveCheckers("FartherHallway")
local waitTimeResult = waitTimes[math.random(1,#waitTimes)]
wait(waitTimeResult)
moveCheckers("FrontHall")
local waitTimeResult = waitTimes[math.random(1,#waitTimes)]
wait(waitTimeResult)
moveCheckers("EastHall")
local waitTimeResult = waitTimes[math.random(1,#waitTimes)]
wait(waitTimeResult)
moveCheckers("FartherEastHall")
local waitTimeResult = waitTimes[math.random(1,#waitTimes)]
wait(waitTimeResult)
moveCheckers("Door")
end
end
Does anyone know why?
Line: 42
