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

Forcefield is removed when jumping?

Asked by 6 years ago

So, in Roblox Studio, it works just fine. The forcefield regenerates itself and everything. In game, however, whenever I jump, the forcefield just destroys itself.

What I'm doing here is I'm making a safezone. The block that is the safezone is taller than the player, so I should still be touching it. Any help would be appreciated. Thanks.

function WalkingOn(connected)
    if not connected.Parent:FindFirstChild("Humanoid") then return end
    if connected.Parent:FindFirstChild("ForceField") then return end
    Instance.new("ForceField", connected.Parent)
end
script. Parent.Touched:connect(WalkingOn)

function DoneWalkingOn(connected)
    if not connected.Parent:FindFirstChild("Humanoid") then return end
    if connected.Parent:FindFirstChild("ForceField") then
        connected.Parent.ForceField:Destroy()
    end
end
script.Parent.TouchEnded:connect(DoneWalkingOn)
0
Your TouchEnded event triggers when a player jumps since a part of their body manages to stick out of your safezone, however, since they haven't fully left the safezone, they can't trigger the Touched event again, thus the forcefield won't reappear. Le_Teapots 913 — 6y
0
I made the safezone absurdly huge in height, so that shouldn't be the problem? Mathboy9809 4 — 6y

Answer this question