Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix script time out allowed execution time ?

Asked by 3 years ago
Edited 3 years ago
local spike = game.ServerStorage:WaitForChild("Spike")
local danger = game.ServerStorage:WaitForChild("Danger")
local X = Instance.new("NumberValue")
local Z = Instance.new("NumberValue")

while true do
    X.Value = math.random(-72,  -65)
    Z.Value = math.random(-110, 26)
    local spike2 = spike:Clone()
    local danger2 = danger:Clone()
    danger2.Parent = game.Workspace
    danger2.Position = Vector3.new(X.Value, danger2.Position.Y,  Z.Value )
    spike2.Position = Vector3.new(X.Value, spike2.Position.Y,  Z.Value )
    wait(1.5)
    spike2.Parent = game.Workspace
    danger2.Parent = nil
end

0
try putting a print statement before the wait() and see if it outputs anything mariohead13 129 — 3y
0
nothing minefeekyt 4 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

nvm it did but same error !!

Ad
Log in to vote
0
Answered by 3 years ago

Your script runs too fast, maybe add a wait in the while true loop.

Answer this question