Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Click Count script
- while wait() do
- local player = game.Players.LocalPlayer
- script.Parent.Text = "Clicks: "..player:WaitForChild("leaderstats"):FindFirstChild("Clicks").Value
- end
- --detector script
- local ClicksButton = script.Parent
- local replicatedStorage = game:GetService("ReplicatedStorage")
- local RemoteEvents = replicatedStorage:WaitForChild("RemoteEvents")
- local clickEvents = RemoteEvents:WaitForChild("click")
- local Players = game:GetService("Players")
- local player = Players.LocalPlayer
- function debounce(func)
- local inRunning = false
- return function()
- if not isRunning then
- isRunning = true
- wait(0.05)
- func()
- isRunning = false
- end
- end
- end
- ClicksButton.MouseButton1Click:Connect(function()
- clickEvents:FireServer(player)
- end)
- --Click script
- local leaderstats = game.Players.LocalPlayer:WaitForChild("leaderstats")
- local button = script.Parent
- button.MouseButton1Click:Connect(function()
- game.Workspace.GetClickScript.GetClick:FireServer()
- end)
- --leaderstats
- game.Players.PlayerAdded:Connect(function(plr)
- local leaderstats = Instance.new("Folder", plr)
- leaderstats.Name = "leaderstats"
- local Clicks = Instance.new("IntValue", leaderstats)
- Clicks.Name = "Clicks"
- end)
- --script in workspace
- script.GetClick.OnServerEvent:Connect(function(plr)
- local leaderstats = plr:WaitForChild("leaderstats")
- leaderstats.Clicks.Value = leaderstats.Clicks.Value + 1
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement