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) ~~~~~~~~~~~~~~~~~
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
.