So my code for a keycard wont work can anyone help?
local rs = game:WaitForChild("ReplicatedStorage") local fa = rs.AccessCards.FullAccess local leaderstats = game.Players.LocalPlayer.leaderstats --could be the problem game.Players.PlayerAdded:Connect(function(player) if leaderstats.Rank.Value == ("Dev.. Mayor Chill") then -- could also be the problem local clone = fa:Clone() clone.Parent = player.Backpack end end)
I think I got it. LocalPlayer doesn't load in for a long time, instead use player.leaderstats where checking for a rank. Hopefully it works, otherwise add in a 0.2 second delay to let it all load in!
ive got a new code but now its indexing nil with Backpack
local rs = game:WaitForChild("ReplicatedStorage") local fa = rs.AccessCards.FullAccess game.Players.PlayerAdded:Connect(function(player) wait(0.2) local leaderstats = player:WaitForChild("leaderstats") local players = game.Players.LocalPlayer local backpack = players.BackPack if leaderstats.Rank.Value == ("Dev") then local clone = fa:Clone() clone.Parent = backpack end end)