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

the script is running for a while and is hanging? wut?

Asked by 7 years ago
function onTouched(hit) 
if (hit.Parent:FindFirstChild("Humanoid") ~= nil) then
local d = hit.Parent:GetChildren() 
for i=1, #d do 
if (d[i].className == "Tool") then 
d[i].StoredAmmo.Value = d[i].MaxAmmo.Value
if script.Parent.Parent.Percentage.Value < 0 then
    script.Parent.Parent:remove ()
else
script.Parent.Parent.Percentage.Value = script.Parent.Parent.Percentage.Value - 10
end
script.Sound:play()
script.Disabled = true
wait (10)
script.Disabled = false
end 
end
end
end

script.Parent.Touched:connect(onTouched) 

this was working less then 24 hours ago i cant figure whats wrong on it its saying the last end isnt working but it needs to be theres so i just need some help

0
giv the exact error please RubenKan 3615 — 7y
3
You should not be using script.Disabled it is very bad practice User#5423 17 — 7y

Answer this question