I don't really know how to get player names. I assume it's something like
local button = game.Workspace.Button
button.ClickDetector.MouseClick:Connect(function()
if Player.Name = "RogueSalvation", "friend" then
-- Code
end
end
I don't really know how to get player names. I assume it's something like
local button = game.Workspace.Button
button.ClickDetector.MouseClick:Connect(function()
if Player.Name = "RogueSalvation", "friend" then
-- Code
end
end
To access the player, you would put player in the empty brackets (player). That will be the player who clicked. Then .Name is self-explanatory.
local button = game.Workspace.Button
button.ClickDetector.MouseClick:Connect(function(player) --player is the player who clicked
if player.Name == "RogueSalvation" or "" then --Not sure if it can access to see who your friends are
--code
end
end)
Sorry, didn't see his answer. Not sure if you can access friends like that, maybe you can. But if you didn't want all of them to be able to access it, you would do if it equals your name, friends and does not equal ~= that persons name then.
local button = game.Workspace.Button
button.ClickDetector.MouseClick:Connect(function(player) --Insert the parameter (the player who clicked)
if player.Name == "RogueSalvation" or "friend" then --make sure to use the double equal sign, use or to indicate one or the other
-- Code
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Yeah, kinda like that. You would have to get the player who clicked, and see if there name matches. So put player in the empty (player)