Is this script correct?

I am making rank scripts for my new game, and i want to change a value. i am using “Simple Currency Script” By Josima (and there are a few numbers by his name.) this is the original script:

------------------------------------Variables----------------------------------------------

CurrencyName = "Play Points" --Change "Cash" to whatever the name of yor currency will be.
StarterValue = 0 --How much currency the player will start with.

------------------------------------Repeat----------------------------------------------

Repeat = true --Set to false if you don't want the script to repeat giving currency! 
WaitBetweenPayout = 10 --How often the players will be given currency.
PayOut = 10 --How much currency the player will get.













--Script by JOSIMA33











----------------------------Don't change anything below!!!------------------------------


game.Players.PlayerAdded:connect(function(plr)
	local fold = Instance.new("Folder", plr)
	fold.Name = "leaderstats" 
	val = Instance.new("IntValue", fold)
	val.Name = CurrencyName
	val.Value = StarterValue
end)


while true do
	wait()
	if Repeat == true then
		wait(WaitBetweenPayout)
		val.Value = val.Value+PayOut 
	end
end

now for my rank system, i followed a roblox tutorial to get a click detector and a buy script, and i want to change those values. I actually changed the WaitBetweenPayout and PayOut to number value’s that i named the exact same. now, this is my shop script

if playerGold.Value >= upgradeCost then
	print("Player can buy the item")
	playerGold.Value = playerGold.Value - upgradeCost
	game.Workspace.LeaderboardScript.PayOut.Value = 700
	game.Workspace.LeaderboardScript.WaitBetweenPayout = 23
	game.Workspace.LeaderboardScript.val.Value = 0

now, i actually only changed the PayOut to a number value, and wanted to know if the WaitBetweenPayout line still works as the number is still a variable in the script. Does this work, or do i have to make the WaitBetweenPayout a number value too?

1 Like

I’am not understanding that much, could you elaborate? From what i see, you made these values:

An actual value instance?

Please elaborate.

And, can you show the full script/more of this part?:

The first thing is fine. But the second one will have issues because you forgot an end.

Don’t use the second argument when creating a new instance.

Given that large number of registers, the Lua precompiler is able to store all local variables in registers. The result is that access to local variables is very fast in Lua. Use local and try not to “pollute” the global environment.

1 Like

I’d suggest changing this category to #help-and-feedback:code-review as this category is more for scripting help and/or issues with code while code review is for this type of issue.

1 Like

I made this a long time ago. I’m sorry :frowning:

1 Like