Hey! So, I used Zednov's tycoon kit to make this game, and he uses a string value for the currency (so the cash could use abbreviations; 1k, 1m, 1b, etc.)
I am trying to make a shop GUI shop and the script I made works totally fine until you take away the money from the user. I'm trying to make it where when you buy something, it gives you the item and takes away your cash. I tried several ways and I thought that I'd bring it here for help. I spent weeks trying to figure out how to fix this and I couldn't find any way.
The output says:
23:12:37.517 - Players.goldenkings11.PlayerGui.Workbench.ScrollingFrame.Bucket.TextButton.LocalScript:7: attempt to perform arithmetic (sub) on string
I truly think the string value has something to do with it and I tried changing it to other values, but the tycoon didn't work properly (whenever you collected cash, your money resetted back to 0). I'm sure this is an easy fix and I'm just blind. I'm not the best at scripting, but I have some experience, so please don't judge me. Thank you in advance!
script.Parent.MouseButton1Click:Connect(function(player)
player = game.Players.LocalPlayer
if player.leaderstats.Cash.Value >= player.leaderstats.Cash.Value then
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - script.Parent.Price.Value -- the part that doesn't wory
print("success")
game.Lighting.Tools.Bucket:Clone().Parent = player.Backpack
else
print("not enough")
script.Parent.Text = "Not Enough!"
wait (2)
script.Parent.Text = "Price: $".. script.Parent.Price.Value
end
end)

2 comments
I think you completely misread the error message, since it's clearly NOT telling you to convert the value to a string (I already thought it was too?). What the error says is that arithmetic (subtraction) was done on a string. This is only done on line 4.
yes i am dumb