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

Why is the boolean niling in the local player?

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.

6 comments

0

Try maybe defining local player on line 01 as "local players = game:GetService("Players")

0

Then putting "local player = Players.LocalPlayer

0

@ExHydraboy nice try but there isn't really a difference between "game.Players" and "game:GetService("Players")"

0

is this on the client or server?

0

server

0

You can not get the local player on the server

1 answer

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)

1 comment

0

let me know if that helped ... and if it was what you wanted :)

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