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

Player is not valid member of model?

Asked by 6 years ago

function LeaderBoard(Fisherman) local leaderstats = Instance.new("Model") leaderstats.Name = "leaderstats" leaderstats.Parent = Fisherman

local money = Instance.new("IntValue")
money.Name = "Name" money.Parent = leaderstats money.Value = 10

end

game.Players.PlayerAdded:connect(LeaderBoard()

I have copied this code from one video but when i press start it says player is not valid member of model. What i should do or what i have done wrong?

1 answer

Log in to vote
0
Answered by 6 years ago

The only problem I see with your code is when you tried to connect the PlayerAdded event. You have an open bracket that was left by itself inside the event Connection. I fixed that, however, I am not in ROBLOX studio right now so I cannot test this.

function LeaderBoard(Player) 
    local leaderstats = Instance.new("Model") 
    leaderstats.Name = "leaderstats" 
    leaderstats.Parent = Player
    local money = Instance.new("IntValue")
    money.Name = "Name" 
    money.Value = 10
    money.Parent = leaderstats 
end

game.Players.PlayerAdded:connect(LeaderBoard)
Ad

Answer this question