Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to program specifications in game rounds?

Asked by 6 years ago

So I'm new to scripting. I'm attempting to teach myself through video tutorials and also editing free models as much as possible.

So my current goal for the game I'm making is for it to have rounds. Now, I want these rounds to last for lets say.. 5 minutes. However, I want them to end the round IF the enemy base (or a humanoid in the center of the base etc) health reaches 0. I have no idea of how to even get started with this, so any help is greatly appreciated.

Also, if anyone likes teaching, message me anytime, as I would love to be a 'student' thanks

1 answer

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago

If there is a Humanoid inside the base, you can use the Died event to check when it is dead.

local roundTime = 5*60
local roundStopped = false

while true do
    print("Round starting...")
    for i = roundTime,0,-1 do
        if roundStopped then break end
        print(i .. " seconds left!")
        wait(1)
    end
    roundStopped = false
    print("Round finished")
end

workspace["BaseNameHere"].Humanoid.Died:Connect(function()
    roundStopped = true
end)

If you ever have any questions you can always message me too, and I'll try my best to help.

0
Didn't even consider creating a variable to call the function like that... thank you! I'll send you a request on roblox if thats okay! iAreButterz 0 — 6y
Ad

Answer this question