Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Currency Increase Script not working?

My Currency Increase Script Is not working anybody know why?

The script:

amount = 1 -- value given
timedelay = 1 -- time before value given
currencyname = "Time"-- Name of value
while true do
	wait(timedelay)
	for i,v in pairs(game.Players:GetPlayers()) do
		if v:FindFirstChild("leaderstats") then
			v.leaderstats[currencyname].Value =  v.leaderstats[currencyname].Value + 1
		end
	end
end

7 comments

0

I recommend using the (recently added) += operator to add onto the same value in memory, skipping the need to rewrite it entirely. Other than that nitpick, please show any potential error messages. Thanks!

0

if there was an error message he would have stated it. Not stating it is against the rules ^

0

The += operator does the exact same thing as val = val + 1, it was only included as a long requested QoL update.

0

You clearly taken it from alvin blox

0

@misha123 Considering he just joined today at the time of posting, I can't expect them to be completely familiar with the ins and outs of the rules.

0

Yea sorry i didn't add the error i didn't know here it is: 19:01:33.723 - ServerScriptService.Script:9: attempt to perform arithmetic (add) on boolean and number

0

@JasiuJasiuB yea because i couldn't figure out the problem after a hour

1 answer

You should use a Normal Script [NOT LOCALSCRIPT] in serverscriptservice to make this work. Insert a Normal Script in ServerScriptService and write exactly what you have written there.

I hope that helps :D

1 comment

0

Its fixed now the problem was i was using a BoolValue and not a IntValue

This discussion is preserved as it was. New answers, comments, and votes are closed.