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

Why is the boolean niling in the local player?

Asked by
proo34 41
4 years ago
local groupId = 5144614
local Admin = game.Players.LocalPlayer.importantplr.Admin

function added(player)


if game.Players.LocalPlayer:GetRankInGroup(groupId) <= 16 then
        game.Players.LocalPlayer:WaitForChild("importantplr")
        game.Players.LocalPlayer.importantplr:WaitForChild("Admin")
        Admin.Value = true
    else
        Admin.Value = false
end

end

game.Players.PlayerAdded:connect(added)

Its purpose is to change a value known as admin, which is a boolean that is used so my scripts can read it and then decide if the player should see somethings or not. It keeps niling. I dont understand why, thanks for the help.

0
Try maybe defining local player on line 01 as "local players = game:GetService("Players") ExHydraboy 30 — 4y
0
Then putting "local player = Players.LocalPlayer ExHydraboy 30 — 4y
0
@ExHydraboy nice try but there isn't really a difference between "game.Players" and "game:GetService("Players")" starmaq 1290 — 4y
0
is this on the client or server? ForeverBrown 356 — 4y
View all comments (2 more)
0
server proo34 41 — 4y
0
You can not get the local player on the server ForeverBrown 356 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

I'd write your code like this...

I changed the function format(does the same thing) also changed your "local player" to player since the playeradded function will give you the player

local groupId = 5144614

game.Players.PlayerAdded:Connect(function(player)
    local Admin = player:WaitForChild(importantplr).Admin
    if player:GetRankInGroup(groupId) <= 16 then
        Admin.Value = true
    else
        Admin.Value = false
    end 
end)
0
let me know if that helped ... and if it was what you wanted :) ForeverBrown 356 — 4y
Ad

Answer this question