|
| 03 Aug 2016 02:00 PM |
I am trying to make it so if a player presses on a gui they can either disable or enable pvp, but mine seems to not be working. Here is my script: Player = script.Parent.Parent.Parent local PvpValue = script.Parent:FindFirstChild("PvpValue") local PvpEnabled = true if PvpEnabled == true then PvpValue.Value = true and Player.Humanoid.Health == 100 script.Parent.Text = "Pvp Enabled" else if PvpEnabled == false then PvpValue.Value = true and Player.Humanoid.Health == 10000000000000000000000000000000000000000000000000000000 script.Parent.Text = "Pvp Disabled" end end |
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
| |
|
|
| 03 Aug 2016 02:26 PM |
Where is player being told what it is? like game.Players.LocalPlayer? |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Aug 2016 02:37 PM |
| Seriously indent dude. If you don't you'll get a headache. |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 02:38 PM |
| Hey scripted and you should see if you could make It an infinite health script. |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 02:41 PM |
if PVP.Enabled = false then humanoid.health = math.Huge
this is just the short version |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 02:44 PM |
| How about if I wanted it to happen when a player clicks on it? |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 02:45 PM |
script.Parent.MouseButton1Click:connect(function() local PvpValue = script.Parent:FindFirstChild("PvpValue") local Player = game.Players.LocalPlayer --Find local player local character = Player.Character --Get character from said player
if PvpValue.Value == true then --If pvp value is true then run PvpValue.Value = false --set pvp value to false character.Humanoid.Health = 100 --get humanoid from character script.Parent.Text = "Pvp Enabled" elseif PvpValue.Value == false then PvpValue.Value = true character.Humanoid.MaxHealth = math.huge script.Parent.Text = "Pvp Disabled" end end) |
|
|
| Report Abuse |
|
|