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

leaderstats is not a valid member of players?

For some reason I keep getting this error. I have tried checking to see if there are any typos but there are none. This is also on a normal script. I need help, thanks.

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function()
		
		local leaderstats = game:GetService("Players").leaderstats.Stage.Value

		if leaderstats >= 40 then
			local Halo = game.ServerStorage.RainbowHalo:Clone()
			Halo.Parent = Player.Character
		end
	end)
end)

1 answer

game.Players is like folder with players, so leaderstats isnt in that folder. You need to get Player. You Already have player from PlayerAdded function so you can use Player.leaderstats....

3 comments

0

I did it but now its not giving me the halo

0

Is the value of stage bigger than 40 when you join the game? That script is checking that value Just when you joined. You can use while wait() do so that will be looping and checking if the value is bigger than 40

0

Or Changed function - Player.leaderstats.Stage.Changed:Connect(function()

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