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?
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.