Hey there, so i'm making a button, if you click it you will recieve a pop up. But i want this to work for only one (or a couple) players. How can i do this? (Be sure that it works with player ID's)
Also please be specific.
-- Var -- local Player = game.Players.LocalPlayer local Button = script.Parent.Button -- Change this to your button local Player1 = 000000000 -- Change these to your ids local Player2 = 000000000 local Player3 = 000000000 local Player4 = 000000000 local Player5 = 000000000 local function listed() print("You are on the list!") -- Do something if the player is on the list end local function notlisted() print("You are not on the list!") -- Do something if the player is not on the list end -- Script -- Button.MouseButton1Click:Connect(function() if Player.UserId == Player1 then listed() elseif Player.UserId == Player2 then listed() elseif Player.UserId == Player3 then listed() elseif Player.UserId == Player4 then listed() elseif Player.UserId == Player5 then listed() else --Add more elseif if you have more player ids notlisted() end end)
This isn't the most efficient script but its the first thing that came to mind, hope it helps!
local ids = {}--put some ids in here and seperate them with a comma local player = game.Players.LocalPlayer Button.MouseButton1Click:Connect(function() if table.find(ids,player.UserId) then --you got it from here end end