I've made a script and put this code but it wont work what is the error?
local price = 2400
local price = 2400
script.Parent.MouseButton1Click:connect(function(click)
local player = game.Players:WaitForChild(click.Name)
if player.leaderstats:FindFirstChild("Coins").Value >= price.Value then
local char = player.Character
char.UpperTorso.Position = Vector3.new(85.64, 10.728, 16.66)
local coins = player.leaderstats:FindFirstChild("Coins")
coins.Value = coins.Value - 2400
end
end)
please help me :( there is no error in output! Im kinda new to scripting

1 comment
a value created by the server cant be changed by a local script(the client). you'll need a remote event on line 9.