Advertisement
OnFireRobloxScriptin

Click for Stats ClickHandler Server Script

Sep 30th, 2024
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. --//Variables
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage") --Variable for Replicated Storage
  3. local ClickEvent = ReplicatedStorage:WaitForChild("ClickEvent") --Variable for Remote Event
  4.  
  5. ClickEvent.OnServerEvent:Connect(function(player) --When the server recieves the Remote Event, check for the player that sent it
  6.     local leaderstats = player:FindFirstChild("leaderstats") --Locate leaderstats under the player
  7.     if player and leaderstats then --If the player exists and leaderstats was located then
  8.         local clicks = leaderstats:FindFirstChild("Clicks") --Locate Clicks Value under the leaderstats
  9.         local randomnum = math.random(1, 5) --Generates a random number between 1 and 5 (1 is the lowest it can choose, 5 is the highest. Change depending on what you need.)
  10.         clicks.Value += randomnum --Adds that random number of stats to the Clicks Value (Replace randomnum with any regular number if you don't want random stats)
  11.     end
  12. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement