|
| 07 Aug 2011 04:19 PM |
This should move a gui from one person to the next when the button "Enter" is clicked. It keeps it on the first persons screen though and there isn't an output. Help please!
local num = 1
script.Parent.Enter.MouseButton1Click:connect(function() num = num + 1 local a=game.Players:GetChildren() if num < #a then script.Parent.Parent = a[num].PlayerGui elseif num > #a then num = 1 script.Parent.Parent = a[num].PlayerGui end print(num) end ) |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2011 04:20 PM |
What will happen is that the script will reset (I believe) when the parent is changed. Causing num to stay at 1. Try a NumberValue inside the gui.
~ Mitch ~ |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2011 04:22 PM |
| So like when the gui is moved to you, the number goes back to 1, bringing it to me? |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2011 04:25 PM |
Here's what I would do.
script.Parent.Enter.MouseButton1Click:connect(function() local a = game.Players:GetChildren() if script.Parent.Current.Value <= #a then script.Parent.Current.Value = script.Parent.Current.Value + 1 script.Parent.Parent = a[script.Parent.Current.Value].PlayerGui else script.Parent.Current.Value = 1 script.Parent.Parent = a[script.Parent.Current.Value = 1].PlayerGui end end)
~ Mitch ~ |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|