You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want to make a badge that gets awarded when you wait alone (only you in server) in a server for a hour
-
What is the issue? I’ve tried testing the script and it didnt seem to work, there were no errors in the output and i couldn’t find what was causing the script to not work.
-
What solutions have you tried so far? I tried looking into the dev forum for solutions but i’ve found nothing related to my issue.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local Players = game:GetService("Players")
local AmountOfPlayers = #Players:GetPlayers()
Players.PlayerAdded:Connect(function(Player)
AmountOfPlayers = AmountOfPlayers + 1
end)
Players.PlayerRemoving:Connect(function(Player)
AmountOfPlayers = AmountOfPlayers - 1
end)
local timeWaited = 0
if AmountOfPlayers == 1 then
while true do
task.wait(1)
timeWaited = timeWaited + 1
print("Added 1 Second to Time Waited")
if AmountOfPlayers == 2 then
timeWaited = 0
print("Time has been reset.")
break
elseif timeWaited >= 10 and AmountOfPlayers == 1 then
local BS = game:GetService("BadgeService")
BS:AwardBadge(Players[1].UserId,2146555899)
print("Badge has been awarded.")
end
end
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.