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

"A script has been running for a long time, and may be hanging." How to fix?

Asked by 7 years ago
Edited 7 years ago

For some reason, I've been getting this error message that requires me to kill my script when I'm testing out my game. Here are the scripts:

local button = script.Parent.TextButton
local frame = script.Parent.Frame

local function findValue()
    local moneyCount = game.Players.LocalPlayer.MoneyCount
end

local function addMoney()
    moneyCount.Value = moneyCount.Value + 1
end

game.Players.PlayerAdded:Connect(findValue)
button.MouseButton1Click:Connect(addMoney)
local frame = script.Parent.Frame
local button = script.Parent.TextButton

function getMoney()
    frame:TweenPosition(UDim2.new(0.5,-100,0.5,-25),'Out','Quint',.5)
    wait(.75)
    frame:TweenPosition(UDim2.new(0.5,-100,10,-25),'In','Quint',.5)
end

button.MouseButton1Click:Connect(getMoney)
local gui = script.Parent
local display = gui.MoneyAmount
local money = game.Players.LocalPlayer.MoneyCount

while true do
    display.Text = money.Value
end

These are both local scripts. I have no idea what this error message means. Help would be appreciated!

EDIT: Another local script. This may be the problem.

1 answer

Log in to vote
0
Answered by
H4X0MSYT 536 Moderation Voter
7 years ago
Edited 7 years ago

This error typically begins with a loop that is running fast and permanently. Did you show the full script? I don't think so. EDIT: There we go, you finally showed the rest.

while true do
end

That will allways cause that error. Add a wait(0.5) in there to stop it from going too fast

0
I'll add an edit with another localscript codytron3234 10 — 7y
0
Thank you very much! That really helped me! codytron3234 10 — 7y
Ad

Answer this question