Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I make a customer not be able to see a surface gui?

I am making this register system and I only want the Trainee's and up to be able to access them. Whenever I use PlayerAdded, it just enables the screen to who joins. (If a worker joins, all the screens will be enabled for everyone including customers.) (The game is FE)

The SurfaceGui is in StarterGui with an Adornee connected to the part in Workspace.

Heres the script (In ServerScriptService):

game.Players.PlayerAdded:Connect(function(player)
	if player:IsInGroup(3639089) and player:GetRankInGroup(3639089) >= 3 then
		player.PlayerGui.SurfaceGui.Enabled = true
	end
end

2 comments

0

you disable it locally :/

0

locally disable it

1 answer

✓ Accepted answer

Your code:

game.Players.PlayerAdded:Connect(function(player)
    if player:IsInGroup(3639089) and player:GetRankInGroup(3639089) >= 3 then
        player.PlayerGui.SurfaceGui.Enabled = true
    end
end

Your problem:

You either have not used a local script or it is because you put end end instead of end end)

How to fix the problem:

use a local script and don't forget to say end), not all cases use end

Fixed code: (USE A local script)

game.Players.PlayerAdded:Connect(function(player)
    if player:IsInGroup(3639089) and player:GetRankInGroup(3639089) >= 3 then
        player.PlayerGui.SurfaceGui.Enabled = true
    end
end) --Here is your problem the script will not work without it! 

More detail:

When using a function you always need to end with end), end will just break the script and if using PlayerGui you must use a local script!

Accept and upvote if this helps!

This discussion is preserved as it was. New answers, comments, and votes are closed.