Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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
0
you disable it locally :/ theking48989987 2147 — 5y
0
locally disable it LoganboyInCO 150 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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!

Ad

Answer this question