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

How do I check if there is there is more than 1 force field in the character?

Asked by
Master_JJ 229 Moderation Voter
9 years ago

I only want 1 force field in the character at a time. How do I check for this? Btw this is in a local script.~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~ local Player = game.Players.LocalPlayer local Character = Player.Character local Mat = workspace.Mat

local FF = Instance.new("ForceField") FF.Parent = Character

Mat.Touched:connect(function(Part) if Part.Parent:FindFirstChild("Humanoid") and Part.Parent:FindFirstChild("ForceField") then local FF = Part.Parent:FindFirstChild("ForceField") FF:Destroy()
end

end)

function InsertFF(Part) if Part.Parent:FindFirstChild("Humanoid") then local FF = Instance.new("ForceField") FF.Parent = Character end end

workspace.Baseplate.Touched:connect(InsertFF) workspace.Floor.Touched:connect(InsertFF) workspace.Step1.Touched:connect(InsertFF) workspace.Step2.Touched:connect(InsertFF)

Answer this question