Hello, i’m trying to make system that verifies if player who clicked on TextButton (In gui) ID’s is 373781098
so far i tryed plr.Name, plr.id but these look kinda broken.
If possible, in server script
Hello, i’m trying to make system that verifies if player who clicked on TextButton (In gui) ID’s is 373781098
so far i tryed plr.Name, plr.id but these look kinda broken.
If possible, in server script
Plr.UserId
Is the way to get a players id
allready tryed, didn’t worked “Attemp to index nil with UserId”
That means your variable for the player is nil, so there’s nothing to check the UserId of.
If plr.UserId == 373781098 then
print("Admin")
end
Works perfectly fine in my scripts…
By the sounds of it your not actually getting the player.
Edit: As above said
Well then how to get player id (and name if possible) from text box
You need a textbox, Then a button to confirm, then when the button is pressed you should use a click event, Then see what the text is inside of that textbox.
I’m using button and click event to confirm it like you said but it doesn’t work
You need a reference to the player instance.
local Players = game:GetService('Players')
local Player = Players.LocalPlayer
if Player.UserId == Number then
print('User %s is an admin!'):format(Player.Name)
end
Thanks, but i tought we just need to use plr.UserId in clickdetectors/buttons
MouseClick has a Player parameter, use that instead if you meant you were using one.
You’re saying it’s a TextButton? Then it should be handled by a localscript, that event does not have any parameters.
Here is script i was using, but it didn’t work
local id = 0
script.Parent.MouseButton1Click:Connect(function(Plr)
id = Plr.UserId
game.ReplicatedStorage.AnnouncementVerify:FireServer(id)
print(id)
end)
MouseButton1Click doesn’t have a Player parameter, use my example.