In my game, I have this lobby. But, players in the arena can kill other players in the lobby. I would like to know how to make a script inside of the brick that gives the player 1 forcefeild (not more than one because it lags the game) when they touch the brick.
You need to check if the character has a forcefield inside it and if it doesn't, give it one.
script.Parent.Touched:connect(function(hit) if not hit.Parent:FindFirstChild("ForceField") then -- if it doesn't find this then: Instance.new("ForceField", hit.Parent) -- makes forcefield and puts into char end end)
It says there is an error for me but when I tested it, It worked perfectly fine! :D
deb = false function onTouched(part) if deb == true then return end deb = true local ff = Instance.new("ForceField",part.Parent) wait(3) deb = false end script.Parent.Touched:connect(onTouched)