Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Teleport GUI Help?

Asked by 9 years ago

Hi there! Good Morning and Good Afternoon. As you maybe notice, I ASKED SO MANY QUESTIONS and I deleted them because I'm embarrassed . I'm putting this question all together! This will be divided into 2 questions 1st How Do I Make A GUI Only shown for a Certain people? Like This?:

game.Players.PlayerAdded:connect(function(plr)
    if plr.Name == "CjGamer1454" then
        local MoveGui = game.ReplicatedStorage["TeleportGUI"]:Clone()
        MoveGui.Parent = plr.PlayerGui
    end
end)

But I want my friend to see it as well. Do I Copy/Paste?

2nd When I press the textbutton I want all players to teleport. How? Like This?:

spawn = game.Workspace.SpawnLocation
player = script.Parent.Parent.Parent.Parent

function onClicked
    player.Character:MoveTo(spawn.Position)
end

script.Parent.MouseButton1Down(onClicked)

But how do I add them all together?

0
yumtaste is showing you how ALL of your friends will see the GUI. If you want another person, then on line to it'll look like "CjGamer1454", "Friend/PersonNameHere" . All you do is add a comma and then a players name inside Quotations alphawolvess 1784 — 9y
0
I don't get he said for the 2nd one to add it to my script and it all went wrong CjGamer1454 0 — 9y

1 answer

Log in to vote
2
Answered by
yumtaste 476 Moderation Voter
9 years ago

First script:

Just replace line 3 with if plr.Name == "CjGamer1514" or plr:IsFriendsWith(57164084) then. The number in the IsFriendsWith method is your user ID; I found it (I just went to your ROBLOX profile).

Second script:

You would use a for loop. Here's an example:

for index, player in pairs(game.Players:GetPlayers()) do
print(player.Name)
end

This goes through Players, which contains all players currently in the server, and prints their name. Just incorporate this into your script. I'll do this one for you and explain the parts of it.

local spawn = workspace:FindFirstChild("SpawnLocation") --gets "SpawnLocation" from workspace

script.Parent.MouseButton1Click:connect(function() --this is just a way of listening for events, your way is also correct
for index, player in pairs(game.Players:GetPlayers()) do --loop that gets a player, runs code, then gets the next player
player.Character:MoveTo(Vector3.new(spawn.Position)) --teleports "player," which changes after all the code in the for loop executes
end
end)

If you have any questions, please feel free to comment! If this answer is helpful, please upvote and accept!

EDIT: If you want only a few people defined by name to see the GUI in script 1, use if plr.Name == ("CjGamer1414" or "yumtaste") then. You can change anything between the quotes, and add more quotes.

0
What Do you mean replace line 3? do you mean line 2? CjGamer1454 0 — 9y
0
And For The Script 2 you made do I just add that to my script 2? CjGamer1454 0 — 9y
0
Lol, I just meant line 2. And for script 2, you replace your code with my code for script 2. yumtaste 476 — 9y
Ad

Answer this question