This script is inside of a TextButton. When you click the button you're supposed to lose 1000 points and have a ForceField around you for one second, then the ForceField Destroys.
The problem is after i lose my points and wait one second, the ForceField doesn't destroy.
script.Parent.MouseButton1Click:connect(function() if game.Players.LocalPlayer.Points.Value > 999 then local ff = game.Players.LocalPlayer.Character:FindFirstChild("ForceField") if not ff then local f = Instance.new("ForceField",game.Players.LocalPlayer.Character) game.Players.LocalPlayer.Points.Value = game.Players.LocalPlayer.Points.Value - 1000 wait(1) print 'waited' if ff then print 'rip' ff:Destroy() end end end end)
I think you made a typo
script.Parent.MouseButton1Click:connect(function() if game.Players.LocalPlayer.Points.Value > 999 then local ff = game.Players.LocalPlayer.Character:FindFirstChild("ForceField") if not ff then local f = Instance.new("ForceField",game.Players.LocalPlayer.Character) game.Players.LocalPlayer.Points.Value = game.Players.LocalPlayer.Points.Value - 1000 wait(1) print 'waited' --right here if f then print 'rip' f:Destroy() end end end end)