it's a real simple script (i'm probably dumb xD) but it's supposed to (if the player has enough tickets) give the player 1 R$ but it keeps giving me "no u" in the output
local tickets = game.Players.LocalPlayer.Data.tix.Value local rbux = game.Players.LocalPlayer.Data.robux.Value script.Parent.MouseButton1Click:connect(function() if tickets < 21 then print("no u") else if tickets >= 21 then tickets = tickets - 21 rbux = rbux + 1 end end end)
Hi darkblooood,
local tickets = 0; -- This is what you're setting it to. Instead of this, you need to set it to the userdata value and then check for the value each time so you get the most updated version. script.Parent.MouseButton1Click:connect(function() if tickets < 21 then -- It will always be lower than 21 because the variable is set to 0 and it never changes. That's what you're basically doing. end end)
local tickets = game.Players.LocalPlayer.Data.tix -- As you can see, it's the userdata value(The object) instead of the value of the object. local rbux = game.Players.LocalPlayer.Data.robux -- Same thing here since you're trying to change properties, you need to address the property in the script rather than just change the variable rbux. script.Parent.MouseButton1Click:connect(function() if tickets.Value < 21 then print("no u") else if tickets.Value >= 21 then tickets = tickets - 21 rbux.Value = rbux.Value + 1 end end end)
Thanks,
Best regards,
~~ KingLoneCat
Press test, then change the value of the tickets to above 21