generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Script not working?

Previous Thread :: Next Thread 
brightScarf is not online. brightScarf
Joined: 02 May 2016
Total Posts: 236
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
brightScarf is not online. brightScarf
Joined: 02 May 2016
Total Posts: 236
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
brightScarf is not online. brightScarf
Joined: 02 May 2016
Total Posts: 236
11 Feb 2017 08:02 PM
For some reason the button isn't working. Any ideas?
Report Abuse
RogueMage is not online. 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
brightScarf is not online. brightScarf
Joined: 02 May 2016
Total Posts: 236
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
brightScarf is not online. brightScarf
Joined: 02 May 2016
Total Posts: 236
11 Feb 2017 08:14 PM
b.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image