|
| 11 Feb 2017 07:58 PM |
| local player = game.Players.LocalPlayer local character = player.Character if not character or not character.Parent then character = ############################ end print("Loaded") script.Parent.MouseButton1Click:connect(function() if ################## ## "OFF" then -- if off ################## = "ON" Instance.new("ForceField", character) print("ON") elseif ################## ## "ON" then -- if on ################## = "OFF" local force = character:FindFirstChild("ForceField") if not force then return end character.ForceField:Destroy() print("OFF") end end) Output: Loaded ON OFF It's obviously loading, but the script doesn't change the #### or give the player # forcefield. (Normally it works, just giving the player # forcefield breaks it.) |
|
|
| Report Abuse |
|
|
|
| 11 Feb 2017 07:58 PM |
local player = game.Players.LocalPlayer local character = player.Character if not character or not character.Parent then character = player.CharacterAdded:wait() end print("Loaded")
script.Parent.MouseButton1Click:connect(function() if script.Parent.Text == "OFF" then -- if off script.Parent.Text = "ON" Instance.new("ForceField", character) print("ON") elseif script.Parent.Text == "ON" then -- if on script.Parent.Text = "OFF" local force = character:FindFirstChild("ForceField") if not force then return end character.ForceField:Destroy() print("OFF") end end) |
|
|
| Report Abuse |
|
|
|
| 11 Feb 2017 08:02 PM |
| For some reason the button isn't working. Any ideas? |
|
|
| Report Abuse |
|
|
RogueMage
|
  |
| Joined: 28 Jan 2012 |
| Total Posts: 1235 |
|
|
| 11 Feb 2017 08:04 PM |
| What part exactly isn't working? The whole thing? Is it giving any errors? If so, what is the error? If it's not giving errors, which part of the code isn't running? We can't exactly know all this stuff just by looking at the code. Honestly, if I look closely I'll probably find it but as a scripter I'm very lazy. |
|
|
| Report Abuse |
|
|
|
| 11 Feb 2017 08:07 PM |
Oh, sorry - I was very vague. So, I have three prints to check it to work: LOADED, ON and OFF. All three print, Yet nothing happens in-game. The forcefield that is meant to be given to the player does not appear, and the button doesn't change from saying "ON" and "OFF". |
|
|
| Report Abuse |
|
|
| |
|