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

Touched event from the part works for 3 times, then stops working?

Asked by 6 years ago
Edited 6 years ago

im making a water script (please dont ask why) and its supposed to use a bodyposition to make it float. It does work but for some reason it only works for 3 times, and sometimes it doesnt even work.. why?

01local debounce = false
02script.Parent.Touched:Connect(function(hit)
03    if not debounce then
04        if hit.Parent.Torso then -- i did this because sometimes a accesory will get hit
05        debounce = true
06        local yes = game.Players:GetPlayerFromCharacter(hit.Parent)
07        game.Workspace.deletethingy:FireClient(yes)
08                wait(0.00001)
09        local e = Instance.new("BodyPosition")
10        e.Name = "Water"
11        e.Parent = hit.Parent.Torso
12        e.MaxForce = Vector3.new(4000,4000*e.Parent.Parent.UpDownMultiplier.Value*10,4000)
13        local m = game.Lighting.waterscript:Clone()
14        m.Parent = e
15        wait(0.3)
View all 30 lines...

1 answer

Log in to vote
-2
Answered by 6 years ago

Remove All Debounces

0
This is possibly the worst 'answer' I've seen. One sentence? No information.  Don't try to answer to get reputation, you won't get it. This is a help website, not a game so don't bother if you think that it's all about reputation, this is about helping people and giving new views/insight into problems. Sorry if this was over the top but it had to be said. turtle2004 167 — 6y
0
I cant remove all debounces, it will spam the touch event. jdm4llfem8 94 — 6y
Ad

Answer this question