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

"money is not a valid member of player"?

Asked by 5 years ago

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

0
Can you show the hierarchy of the 'Money' instance? Rare_tendo 3000 — 5y
0
Im still new to this whole scripting thing, what do you mean by hierarchy? Pr_ogram 17 — 5y
0
Show the whole parent tree of the 'Money' instance Rare_tendo 3000 — 5y
0
Money - parent:leaderstats leaderstats-parent:player Pr_ogram 17 — 5y
0
is that ok? Pr_ogram 17 — 5y

2 answers

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

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
0
That wouldn't work, it's comparing a userdata to a number Pr_ogram 17 — 5y
0
Oops, I missed something in there, but I fixed the code Rare_tendo 3000 — 5y
0
still wont work Pr_ogram 17 — 5y
0
doesn't matter i gave up on that idea Pr_ogram 17 — 5y
Ad
Log in to vote
0
Answered by
green271 635 Moderation Voter
5 years ago

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

Answer this question