This isn't working and I'd like to know why. This script is supposed to function to where, when a gui is clicked, you buy color for a brick. I'm not sure what the problem is, please help me. Edit: Would someone please help?
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local cash = Instance.new("IntValue")
moneyToGive = -60
print "line 5"
function onclick()
if cash.Value < 60 then
script.Sound2:Play()
end
if cash.Value >= 60 then
cash.Value = cash.Value + moneyToGive
script.Sound:Play()
print "line 14"
game.Workspace.Desperado.Body.BD.BrickColor = BrickColor.new("Storm blue")
game.Workspace.Desperado.Body.TailG.BrickColor = BrickColor.new("Storm blue")
end
end
script.Parent.MouseButton1Click:connect(onclick)

2 comments
Why are the leaderstats being created on the client
I don't know, I was confused when I was working on this. I don't know how to do it though.