Making a gui only visible to VIP server owners

Ahoy,

I made a GUI recently and tried to show it only for VIP server owners, however this did not work. What i am trying to do is make a vip server benefit GUI. Here is the code i used:

local gui = game.ServerStorage.VIPBENEFITS

game.Players.PlayerAdded:Connect(function(plr)
	if plr.UserId == game.PrivateServerOwnerId then
		local cloned = gui:Clone()
		cloned.Parent = game.StarterGui
	end
end)

Please can you help.

Thanks, Kieran!

2 Likes

You are cloning the gui to the StarterGui. It is not in the player’s PlayerGui, so it is not showing up.

4 Likes

How do i clone it into the StarterGui?

heres how you can clone it to playergui

game.Players.PlayerAdded:Connect(function(plr)
	if plr.UserId == game.PrivateServerOwnerId then
		local cloned = gui:Clone()
		cloned.Parent = plr:WaitForChild("PlayerGui")
	end
end)
3 Likes

Yes this is correct. :slight_smile:

2 Likes

Just to clarify, am i doing this in a Server script or a Client script?

This is a server script to block out exploiters

2 Likes

Ok, i have just tried this and it didn’t work.

1 Like

Can we see the errors, so we can see whats wrong

2 Likes

There is no errors in the output.

What is the variable defined as “gui” by the way?

local gui = game.ServerStorage.VIPBENEFITS

Alright, it is enabled and all that, right?

1 Like

Oh, thank you i forgot to enable it, ill just test that now, sorry!

No problem! Just tell me if it still isn’t working after that.

1 Like

Yeah, everything is perfect. Thank you!

1 Like

No problem! Glad it works now :slight_smile:

1 Like