Advertisement
OnFireRobloxScriptin

Click for Stats ClickHandler localscript

Sep 30th, 2024
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. --//Variables
  2. local button = script.Parent --Variable for the button
  3. local ReplicatedStorage = game:GetService("ReplicatedStorage") --Variable for Replicated Storage
  4. local ClickEvent = ReplicatedStorage:WaitForChild("ClickEvent") --Variable for Remote Event
  5. local canclick = true --Cooldown Boolean
  6.  
  7. --//Click for stats
  8. button.MouseButton1Click:Connect(function() --When button is clicked
  9.     if canclick then --If the user can click the button then
  10.         canclick = false --The user can not click the button now
  11.         ClickEvent:FireServer() --Fires the Remote Event to the server
  12.         task.wait(3) --3 Second cooldown (Change 3 to how many seconds you want the cooldown to be. Or delete this line for no cooldown)
  13.         canclick = true --The user can click the button  now
  14.     end
  15. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement