My local script doesnt work despite not showing any errors

I want to make it when the player joins it checks his username and if it is the right username it opens a GUI

I’ve tried changing where the script is located at but nothing, also this is a localscript

Here is where the script is located, already tried changing it to starterpack, startercharacterscript but nothing work, Maybe it is the code but I don’t see anything wrong with it.
image

task.wait(2)

local PlayerS = game:GetService("Players")

PlayerS.PlayerAdded:Connect(function(player)
	if player.Name == "GuipaGG" then
		player.PlayerGui:WaitForChild("OwnerPrompt").OpenCommands.Visible = true
		print("Admin Joined")
	else
		print("Player is not admin.")	
	end
end)


Here you can see that the ScreenGui is enabled, the code and that is placed at the playerscripts.

1 Like

Can someone help pleaseeeeeeeaaaa

Do:

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

if LocalPlayer.Name == "GuipaGG" then
	script.Parent:WaitForChild("OpenCommands").Visible = true
	print("Admin Joined")
else
	print("Player is not admin.")	
end

Place the script in the ScreenGui called OwnerPrompt

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.