I had made an script that is supposed to give a tool if a player has a certain rank, it only works in studio but not in the actual game. ( I’m using accurate solo play )
No output errors and this is the script.
local function giveAccessCard()
print("true") -- Prints in studio but not in the actual game..
if player.leaderstats.Rank.Value == "Royal Family" or player.leaderstats.Rank.Value == "Sheikh Al Khara" or player.leaderstats.Rank.Value == "Cabinet Ministers" and not player.Backpack:FindFirstChild("Royal Access Card") or player.Character:FindFirstChild("Royal Access Card") then
local accessCard = ServerStorage:WaitForChild("Tools")["Royal Access Card"]:Clone()
accessCard.Parent = player:WaitForChild("Backpack")
repeat wait(1) until player.Backpack:FindFirstChild("Royal Access Card") or player.Character:FindFirstChild("Royal Access Card")
end
end
player.CharacterAdded:Connect(function(Character)
Character:WaitForChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
end)
giveAccessCard()
end) -- I havent showed the full script but this end is for the player added event