When Player hits Button, the forcefield is disabled!

I need a script that when you click a button, the forcefield is disabled but if the button is not clicked the forcefield is not disabled!

Any help or solution!

2 Likes

As @xander5610 said, you can’t just ask for full scripts here just like that. However to guide you in the right direction, here is the wiki for forcefields.

Also may I ask, are you talking about a UI button or a part with a ClickDetector?

1 Like

Like the @xander5610 said, you shouldn’t ask others for complete scripts, but I will help you out this time.

Serverscript

ClickDetector.MouseClick:Connect(function(plr)
if workspace[plr.Name]:FindFirstChild("ForceField") then
workspace[plr.Name].ForceField:Destroy()
end
end)
1 Like

Use Player.Character instead of workspace[plr.Name]. There could be clones of the character around, so it’s just a precaution.

1 Like

nvm i got it solved! sorry for does who helped me!