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

I can't turn off PvP after I turn it on?

Asked by
0msh 333 Moderation Voter
6 years ago

my PvP script only work once, which means when I turn PvP on, I'm unable to turn it off, what is the error?

local player = game.Players.LocalPlayer if(player:WaitForChild("pvp", 2) == nil) then pvpEnabled = Instance.new("BoolValue") pvpEnabled.Name = "pvp" pvpEnabled.Parent = player pvpEnabled.Value = false else pvpEnabled = player.pvp pvpEnabled.Value = false end

local button = script.Parent.Frame.button local debounce = false function changePvp() if pvpEnabled.Value == false then if debounce == false then button.Text = "Enabled" debounce = true for i = 30,0,-1 do button.Text = i wait(1) if i == 0 then debounce = false button.Text = "Enabled" pvpEnabled.Value = true end end else if pvpEnabled == true then if debounce == false then button.Text = "Disabled" debounce = true for i = 30,0,-1 do button.Text = i wait(1) if i == 0 then debounce = false button.Text = "Disabled" pvpEnabled.Value = false end end end end end end end button.MouseButton1Down:connect(changePvp)

0
Use the code block formatter to make the code easier to read please. RayCurse 1518 — 6y

Answer this question