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 » Scripting Helpers
Home Search
 

Re: Get GUI From Lighting

Previous Thread :: Next Thread 
stefi51 is not online. stefi51
Joined: 28 Feb 2010
Total Posts: 1105
11 Aug 2012 01:27 AM
I need this script to, when a button is clicked on a GUI, get a GUI from the lighting and place it in the player's GUI


function onButtonClicked()
if game:GetService("Players"):GetPlayerFromCharacter(onButtonClicked) then
game.Lighting.Rust.CodeRust.Parent = game:GetService("Players"):GetPlayerFromCharacter(onButtonClicked).PlayerGui
script.Parent.Parent:remove()
end

script.Parent.MouseButton1Click:connect(onButtonClicked)

[ I can never get this script right, please help ]

Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
11 Aug 2012 01:32 AM
Am pretty sure it's

game.Players:GetPlayerFromCharacter(character)
Report Abuse
stefi51 is not online. stefi51
Joined: 28 Feb 2010
Total Posts: 1105
11 Aug 2012 01:33 AM
Yeah, it is, Idk why I put.. Im not thinking straight.. it still doesn't work, even if I fixed that.
Report Abuse
stefi51 is not online. stefi51
Joined: 28 Feb 2010
Total Posts: 1105
11 Aug 2012 01:35 AM
Can someone just redo this script, cause I think I have it all wrong. I need the script to, when a person clicks the GUI button, get a GUI from the lighting and clone it to the playerGUI.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
11 Aug 2012 01:36 AM
I don't know about yours paths..


function onButtonClicked(player)
game.Lighting.Rust.CodeRust.Parent = player.PlayerGui
end

script.Parent.Parent:Destroy()

script.Parent.MouseButton1Click:connect(onButtonClicked)
Report Abuse
stefi51 is not online. stefi51
Joined: 28 Feb 2010
Total Posts: 1105
11 Aug 2012 01:39 AM
"Players.stefi51.PlayerGui.Control Panel.CP.Code Rust.Script:2: attempt to index local 'player' (a nil value)"

Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
11 Aug 2012 01:43 AM
Oh wait it's a click script.

I don't know.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
11 Aug 2012 01:50 AM
Workspace.Part.ClickDetector.MouseClick:connect(function(player)
game.Lighting.Rust.CodeRust.Parent = player.PlayerGui
end

script.Parent.Parent:Destroy()

script.Parent.MouseButton1Click:connect(onButtonClicked)

or is it player.Name hmm..
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
11 Aug 2012 01:50 AM
oh crap wrong.

Workspace.Part.ClickDetector.MouseClick:connect(function(player)
game.Lighting.Rust.CodeRust.Parent = player.PlayerGui
end
end)
script.Parent.Parent:Destroy()
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
11 Aug 2012 01:54 AM
I'm re-writing it as a gui button click. Hold on...
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
11 Aug 2012 01:59 AM
script.Parent.MouseButton1Down:connect(function()
plr = script.Parent.Parent.Parent.Parent --However many are there this is for if its a button in a ScreenGui in StarterGui if in a frame in a Startergui, add one more parent
if plr ~= nil then
s = game.Lighting.Rust.CodeRust:clone()
s.Parent = plr.PlayerGui
script.Parent.Parent:Destroy()
end)
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
11 Aug 2012 02:03 AM
You can only use :GetPlayerFromCharacter() in a part touched script such as:

script.Parent.Touched:connect(function(hit)
if hit.Parent.Humanoid ~= nil then
plr = game.Players:GetPlayerFromCharacter(hit.Parent)
s = Instance.new("Hint",plr.PlayerGui)
s.Name = "Hi"
s.Text = "Ouch! You stepped on me!"
wait(5)
plr.PlayerGui.Hi:Destroy()
else
return
end
end)
Report Abuse
stefi51 is not online. stefi51
Joined: 28 Feb 2010
Total Posts: 1105
11 Aug 2012 03:00 AM
Okay, I don't need the "script.Parent.Parent:Destroy()" anymore, so take that out of the script, and the output says, "Players.stefi51.PlayerGui.Control Panel.CP.Code Rust.Script:6: unexpected symbol near ')'
Report Abuse
stefi51 is not online. stefi51
Joined: 28 Feb 2010
Total Posts: 1105
11 Aug 2012 06:25 PM
I still need help on this, take a look at the output it gave me when I did your script.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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