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

My Player Stats is saying that Stats is not a valid member of player, fixes?

I'm trying to make specific players have chat tags using Bool values in player stats (I.E V.I.P gamepass people, etc.) but it says everytime I try to edit the player's stats "Stats is not a valid member of Player", heres my code.

local F = Instance.new("Folder")
F.Name = "Stats"
local godking = Instance.new("BoolValue", F)
godking.Name = "GodKing"

game:GetService("Players").PlayerAdded:Connect(function(_plr)
	F.Parent = _plr 
	if _plr.UserId == 88130316 then
		_plr.Stats.GodKing.Value = true
	end
	
end)
			
			
			

1 answer

Hello. Your Folder should have the name: leaderstats for it works. Also, you should create a new Folder and BoolValue each time a player joins. So they'll have their own leaderstats. Here's an example: (Also, make sure it's a Script.)

Here is the updated code:

local MarketplaceService = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(player)
	local FolderStats = Instance.new("Folder", player)
	local VIPStatus = Instance.new("BoolValue", FolderStats)
	FolderStats.Name = "FolderStats"
	VIPStatus.Name = "VIPStatus"
	
	if MarketplaceService:UserOwnsGamePassAsync(player.UserId, PutHereTheGamepassID) then
		VIPStatus.Value = true
	end
end)

4 comments

0

Thank you for the answer, the BoolValue thing is for the chat tags to basically say "Yes this is true so give this person a chat tag."

0

Now that I have used it I think you missunderstood me, I do not want a leader stat however I want a folder full of BoolValues that read true or false based on who joins, and it is true or false locally.

0

I have updated my answer.

0

Also, your code is not working because the Folder has not been parented to the player.

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