Hi, you may be thinking: “Well duh, server-scripts can’t change UI for players.” well, I am doing it through the players PlayerGui, so that is where this question pops in.
For some reason, this script is failing to enable/disable a UI if a player is under a set perm in a datastore. I just can’t wrap my head around why it isn’t working. I’ve tried using a in-game explorer to change my perm level, i’ve tried to delete the perm all in one, etc etc. Any ideas?
Code:
local PermTable = {
["Player"] = 1,
["Moderator"] = 2,
["Administrator"] = 3
}
game.Players.PlayerAdded:Connect(function(plr)
local plrID = plr.UserId
if game.ReplicatedStorage:WaitForChild("DataFolder"):WaitForChild(plrID).Data.PermissionLevel.Value >= 2 then
plr.PlayerGui:WaitForChild("KronozAdminPanel").Enabled = true
else
plr.PlayerGui:WaitForChild("KronozAdminPanel").Enabled = false
end
end)
( Also instead of making a new question for this, how could I go about incorporating the PermTable and checking perms through that with the datastore values? )
if game.ReplicatedStorage:WaitForChild(“DataFolder”):WaitForChild(“plrID”).Data.PermissionLevel >= 2 then
This may be your issue? Are you trying to wait for a folder inside DataFolder named after the player’s UserId? If so you have put the variablename into speechmarks.