Leaderstats not changing with Math Values?

  1. What do you want to achieve? Keep it simple and clear!
    I’m trying to get leaderstat points to turn into another category using math symbols.

The problem that I keep running into is that the script works and all, but the leaderstats don’t change.

This is the full code, for adding changing the leaderstats2

wait(3)

local plr = game.Players.LocalPlayer

local Add = plr.leaderstats2.Subscribers

local remove = plr.leaderstats.Research

-------------------

if remove.Value > 5 then
	while true do
		Add.Value += 1
	end
else if remove.Value < 5 then
		print(plr.Name.." Card Declined..")
	end
end

if remove.Value > 15 then
	while true do
		Add.Value += 4
	end
else if remove.Value < 15 then
		print()
	end
end

if remove.Value > 50 then
	while true do
		Add.Value += 9
	end
else if remove.Value < 50 then
		print()
	end
end

if remove.Value > 10000 then
	while true do
		Add.Value += 9000009
	end
else if remove.Value < 10000 then
		print()
	end
end

I’ve tried remaking the script, it just doesn’t work. Perhaps somebody can help me??

Okay first off why are there so many if statements and while loops

if remove.Value was less than 50 it would go through the first if statement which would be false so it would print and go to the second if statement which would be false so it would print and go to the third if statement which would be false so it would print and go to the fourth if statement which would be false so it would print.

if remove.Value was greater than 50 it would go through the first if statement and get stuck in the while loop forever


the second thing is you are changing the leaderstat on a LocalScript so it won’t replicate to the server never trust values set by the client, because they can change it to anything instead fire a remote event and have the server set the value

1 Like