FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 03 Jul 2014 04:18 PM |
game.Players.PlayerAdded:connect(function(playa) if playa.userId==game.CreatorId then playa.CharacterAdded:connect(function(char) script.REF:clone().Parent=playa.PlayerGui; end ) end end )
script.Parent.Touched:connect(function(hit) if hit.Parent:findFirstChild("Humanoid") then pname = hit.Parent.Name script.REF:clone().Parent = game.Players.."pname"..PlayerGui end end)
i borrowed the first part from a free model that gives the owner of the place the GUI on entry as you can see, im trying to make another function that will also give you the GUI if you touch a brick that the script is in |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 03 Jul 2014 04:19 PM |
| error message is: line 13 attempt to concatenate global 'PlayerGui' (a nil value) |
|
|
| Report Abuse |
|
|
samy22
|
  |
| Joined: 28 Sep 2008 |
| Total Posts: 2181 |
|
|
| 03 Jul 2014 04:21 PM |
1. Make sure both functions are in the same script. 2. You made a mistake, change this
script.REF:clone().Parent = game.Players.."pname"..PlayerGui
to this
script.REF:clone().Parent = game.Players:findFirstChild(hit.Parent.Name).PlayerGui |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 03 Jul 2014 04:22 PM |
I recommend using waitforchild on the REF
script.REF:clone().Parent = game.Players.."pname"..PlayerGui
> script.REF:clone().Parent = game.Players:FindFirstChild("pname"):FindFirstChild("PlayerGui")
Might break with clones.
|
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 03 Jul 2014 04:22 PM |
Also change script.REF:clone().Parent=playa.PlayerGui; to
script.REF:clone().Parent=playa:WaitForChild("PlayerGui"); |
|
|
| Report Abuse |
|
|
samy22
|
  |
| Joined: 28 Sep 2008 |
| Total Posts: 2181 |
|
|
| 03 Jul 2014 04:23 PM |
pname is already a string variable,
("pname") should be (pname) |
|
|
| Report Abuse |
|
|
goro7
|
  |
| Joined: 01 Jul 2009 |
| Total Posts: 735 |
|
|
| 03 Jul 2014 04:23 PM |
| You cannot concatenate an object with a string. Listen to the error message. |
|
|
| Report Abuse |
|
|
goro7
|
  |
| Joined: 01 Jul 2009 |
| Total Posts: 735 |
|
|
| 03 Jul 2014 04:24 PM |
Change the line: script.REF:clone().Parent = game.Players.."pname"..PlayerGui
TO: script.REF:clone().Parent = game.Players:FindFirstChild(pname).PlayerGui |
|
|
| Report Abuse |
|
|
samy22
|
  |
| Joined: 28 Sep 2008 |
| Total Posts: 2181 |
|
|
| 03 Jul 2014 04:24 PM |
| nvm, just realised even in ", still works.. also waitforchild isn't neccesary i think seen as characteradded is used |
|
|
| Report Abuse |
|
|
FIRECAKE
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 25167 |
|
|
| 03 Jul 2014 04:43 PM |
| thanks i didnt realize i was using a string makes sense now |
|
|
| Report Abuse |
|
|
goro7
|
  |
| Joined: 01 Jul 2009 |
| Total Posts: 735 |
|
| |
|