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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 11 Aug 2012 01:54 AM |
| I'm re-writing it as a gui button click. Hold on... |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|