So I want to do that this gui
only pops up for one person that I want, for example putting the id of that person in a script in this gui so it only pops up for them
You would have to clone/enable it from a server script.
players.PlayerAdded:Connect(function(player)
if player.UserId == 1234 then
local gui = player:WaitForChild("PlayerGui")
gui.BadgeClaimer.Enabled = true
end
end)
Can you tell me step by step how to do that and where to put that script?
ServerScriptService shoul be fine
Alright thank you very much I will test it out now!
Would it be
local players = game.Players
players.PlayerAdded:Connect(function(player)
if player.UserId == 1234 then
local gui = player:WaitForChild(“PlayerGui”)
gui.BadgeClaimer.Enabled = true
end
end)
then
Create a new script in Server Script Service. It may make more sense to clone the gui so move your badge claim gui to a child of the new script, like so.
The script itself will be short, relying on the service “Players” and the fact that each player in the game is given their own “PlayerGui” folder, but only in-game, you cannot find it in studio. The normal use case is that StarterGui is copied into each player’s PlayerGui.
-- players lets you access and manage each player
local players = game:GetService("Players")
-- every time a player joins the game we will ...
players.PlayerAdded:Connect(function(player)
-- check if they are our target user, replace 1234 with the UserId you want
if player.UserId == 1234 then
-- make sure our target has their "PlayerGui" folder
local gui = player:WaitForChild("PlayerGui")
-- clone and insert the gui onto their screen
local clone = script.BadgeClaimer:Clone()
clone.Parent = gui
end
end)
So then I put my ID for example, en it should only be visible to me?
Yes, since it is a server script. Players even hackers cannot see what is inside server scripts.
local players = game:GetService(“Players”)
players.PlayerAdded:Connect(function(player)
if player.UserId == 4175206083 then
local gui = player:WaitForChild(“PlayerGui”)
local clone = script.Ksuy_lav1112:Clone()
clone.Parent = gui
end
end)
isn’t wotking
Nevermind it works, sorry.
rgeiugt8ert6g9we9a6’
Can you show a screenshot of your explorer like I did with Script and BadgeClaimer? Also paste code with three back ticks like so
```
local players = game:GetService(“Players”)
players.PlayerAdded:Connect(function(player)
if player.UserId == 1234 then
```
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.