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

Team not changing when player has enough points?

Asked by
OldBo5 30
6 years ago

So, when I go click a button it gives me a error saying "attempt to compare number with userdata". What I am trying to do is check if a player has 50 or above points then take 50 points from them and make them host. Here is my code: ~~~~~~~~~~~~~~~~~ script.Parent.MouseButton1Click:connect(function() if game.Players.LocalPlayer.leaderstats.Points >= 50 then game.Players.LocalPlayer.leaderstats.Points = game.Players.LocalPlayer.leaderstats.Points - 50 game.Players.LocalPlayer.TeamColor = BrickColor.new("New Yeller") game.Players.LocalPlayer.Character.Torso.CFrame = CFrame.new(14.03, 13.952, -6.602) end end) ~~~~~~~~~~~~~~~~~

0
say white power and then it will work Sqnister -12 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

I think it’s because you forgot to put .Value on every line that has game.Players.LocalPlayer.leaderstats.Points You’re using the value object itself, not the value.

So just change all the lines with game.Players.LocalPlayer.leaderstats.Points into game.Players.LocalPlayer.leaderstats.Points.Value.

Ad

Answer this question