local clickDetector = script.Parent
local player = game.Players.PlayerAdded:Connect(function(plr)
local money = plr.leaderstats.Money
local replicatedStorage = game:GetService("ReplicatedStorage")
clickDetector.MouseClick:Connect(function(player)
money.Value = money.Value + 50
script.Parent.Parent:Destroy()
end)
end)
Can you format the code with a code block please? Also give some more information other than “my code isn’t working and I don’t know why”, because we don’t know what’s wrong with it without any information.
And put this inside what ever you click for the given value…
local clickDetector = script.Parent
local plr = game.Players.PlayerAdded or game:GetService("Players").LocalPlayer
local replicatedStorage = game:GetService("ReplicatedStorage")
clickDetector.MouseClick:Connect(function(plr)
plr.leaderstats.Money.Value += 50
script.Parent.Parent:Destroy()
end)