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

"money is not a valid member of player"?

i'm trying to make a button that teleports you on click if you have a certain amount of a stat in leaderstats. but when i tested it in the output it said "09:48:46.017 - Money is not a valid member of Player"

but when i select children it is part of the player.

can anyone help? here's the script if needed

script.Parent.ClickDetector.MouseClick:Connect(function(plr)

if plr.Money.Value > 0 then -- here's the error "Money"

    plr.Character.HumanoidRootPart.CFrame = CFrame.new(281, 30.6, -26)

end

end) thanks

5 comments

0

Can you show the hierarchy of the 'Money' instance?

0

Im still new to this whole scripting thing, what do you mean by hierarchy?

0

Show the whole parent tree of the 'Money' instance

0

Money - parent:leaderstats leaderstats-parent:player

0

is that ok?

2 answers

✓ Accepted answer

If the Money's parent is leaderstats, then an easy fix is to just do:

if plr.leaderstats.Money.Value > 0 then
       plr.Character.HumanoidRootPart.CFrame = CFrame.new(281, 30.6, -26)
end

4 comments

0

That wouldn't work, it's comparing a userdata to a number

0

Oops, I missed something in there, but I fixed the code

0

still wont work

0

doesn't matter i gave up on that idea

Based on your comment, this is for a leaderboard. The "Money" value should be located in the leaderstats folder. So you'd have to do: plr.leaderstats.Money.Value

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