Как написать скрипт на Roblox Lua, чтобы лидеры возрождались и клики сохранялись?
3 users upvote it!
2 answers
The following script creates a "clicks" variable that will store the number of clicks. Then it creates an "updateLeader" function that increments that number by 1, sets the leader stat (which is a special kind of variable in Roblox) to the current "click" value, and sets a timer that will call this function every second. This way the leader stats will be refreshed every second with the current number of clicks.
-- We set the "clicks" variable to 0 so that we can store the number of clicks later
clicks = 0
-- We are creating the "updateLeader" function that will refresh the leader's stats
function updateLeader()
-- We increase the number of clicks by 1
clicks = clicks + 1
-- We set the leader stat to the current number of clicks
game.Players.LocalPlayer.leaderstats.Clicks.Value = clicks
-- We set a timer that will call this function every second
wait(1)
updateLeader()
end
-- We call the "updateLeader" function
updateLeader()
If you like it, give me a tip :)
The following script creates a "clicks" variable that will store the number of clicks. Then it creates an "updateLeader" function that increments that number by 1, sets the leader stat (which is a special kind of variable in Roblox) to the current "click" value, and sets a timer that will call this function every second. This way the leader stats will be refreshed every second with the current number of clicks.
-- We set the "clicks" variable to 0 so that we can store the number of clicks later
clicks = 0
-- We are creating the "updateLeader" function that will refresh the leader's stats
function updateLeader()
-- We increase the number of clicks by 1
clicks = clicks + 1
-- We set the leader stat to the current number of clicks
game.Players.LocalPlayer.leaderstats.Clicks.Value = clicks
-- We set a timer that will call this function every second
wait(1)
updateLeader()
end
-- We call the "updateLeader" function
updateLeader()
If you like it, give me a tip :)
Machine translated
1 like
Machine translated