Click for Points

Local Script

local button = script.Parent

local clickName = "Money"

local cooldown = false


button.Text = clickName..": "..0


local rs = game:GetService("ReplicatedStorage")

local clickEvent = rs:WaitForChild("ClickEvent")


button.MouseButton1Click:Connect(function()

if not cooldown then

cooldown = true

clickEvent:FireServer()

if not button.Collect.IsPlaying then

button.Collect:Play()

end

wait()

cooldown = false

end

end)


local player = game.Players.LocalPlayer



player.playerstats[clickName].Changed:Connect(function()

button.Text = clickName..": "..player.playerstats[clickName].Value

end)

Script

local clickName = "Money"


game.Players.PlayerAdded:Connect(function(plr)

local playerstats = Instance.new('Folder')

playerstats.Name = 'playerstats'

playerstats.Parent = plr

local clicks = Instance.new("IntValue")

clicks.Name = clickName

clicks.Parent = playerstats

end)



local rs = game:GetService("ReplicatedStorage")

local clickEvent = rs:WaitForChild('ClickEvent')


clickEvent.OnServerEvent:Connect(function(plr)

plr.playerstats[clickName].Value += 1

end)