Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Stea_my 48
4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by
JakyeRU 637 Moderation Voter
4 years ago
Edited 4 years ago

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)
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." Stea_my 48 — 4y
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. Stea_my 48 — 4y
0
I have updated my answer. JakyeRU 637 — 4y
0
Also, your code is not working because the Folder has not been parented to the player. JakyeRU 637 — 4y
Ad

Answer this question