Script not working

I am trying to make a multiplier script that gives the player money by how many multipliers they have (so basically the money you are getting is multiplied by how many multipliers you have)

script

local give = 10 
local plr = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	print(give)
	local x = plr:WaitForChild("Multiplier").Value
	plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + give * x
end)

error

Players.JadtrugamingYT1.PlayerGui.moneyyyyy.TextButton.LocalScript:7: attempt to perform arithmetic (mul) on number and string  -  Client - LocalScript:7
1 Like

is the value “Multiplier” a string value object?

2 Likes

Yes it is is a string value is that the problem, I will change it to a int value and then try it

Ok it works now Thank you for the help

You can also convert a string to a number using tonumber(), like this:

local number = "30"

local outcome = 10 + tonumber(number)
print(outcome) -- Will print 40
1 Like