lensky
|
  |
| Joined: 05 Apr 2009 |
| Total Posts: 884 |
|
|
| 21 Aug 2016 04:34 PM |
Okay so, I have here a teleport script that's supposed to teleport the person who clicked the brick "Origin" and will be teleported to the brick "Destination" and will spawn a loading GUI to the person. Now the problem is, that when a certain individual clicks the Origin, everyone in the server gets teleported to the Destination.
function onClicked(player) local gui = Instance.new("ScreenGui", player.PlayerGui) local label = Instance.new("TextLabel", gui) label.Size = UDim2.new(2, 0, 2, 0) label.Position = UDim2.new(-0.5, 0, -0.5, 0) label.BackgroundColor3 = Color3.new(0,0,0) label.BackgroundTransparency = 1 label.Text = "" local p = game.Players:GetChildren() for i = 1, #p do wait(0.25) while gui and label and label.BackgroundTransparency > 0 do wait() label.BackgroundTransparency = label.BackgroundTransparency - 0.5 end p[i].Character:MoveTo(script.Parent.Parent.Destination.CFrame.p) wait(3) end while gui and label and label.BackgroundTransparency < 1 do wait() label.BackgroundTransparency = label.BackgroundTransparency + 0.5 end if gui then gui:Remove() end end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
I believe the problem in the script is the "local p = game.Players:GetChildren()" which selects all the players, I just don't know what to replace it with. Please help. |
|
|
| Report Abuse |
|
|
lensky
|
  |
| Joined: 05 Apr 2009 |
| Total Posts: 884 |
|
| |
|
lensky
|
  |
| Joined: 05 Apr 2009 |
| Total Posts: 884 |
|
| |
|
lensky
|
  |
| Joined: 05 Apr 2009 |
| Total Posts: 884 |
|
|
| 21 Aug 2016 04:48 PM |
| I really need help with this. |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2016 04:50 PM |
replace p's value with the 'player' parameter in your function. also for god's sake please clean up your code (im a hypocrite though you should see my lua code) and if it doesnt work then why do you have an argument that is supposed to be the player..... |
|
|
| Report Abuse |
|
|
lensky
|
  |
| Joined: 05 Apr 2009 |
| Total Posts: 884 |
|
|
| 21 Aug 2016 04:55 PM |
Mmk and the reason why it looks dirt is cus it's supposed to spawn a GUI to the player who cliked it. Kay? |
|
|
| Report Abuse |
|
|
| |
|