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
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!