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)

2 comments

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.

0

I made the safezone absurdly huge in height, so that shouldn't be the problem?