Ad
Log in to vote
-3

Eaten by a black hole... lol?

Asked by
TrollD3 105
7 years ago

DELETE***************DELETE***************

0
The Walkspeed property is in the character's Humanoid. Grenaderade 525 — 7y

2 answers

Log in to vote
0
Answered by
RedCombee 585 Moderation Voter
7 years ago

It will make your script a lot more efficient to create a variable instead of using so many lines of code.

 local h = script.Parent
hcount = 60 -- your variable
while wait(1) do -- you can use wait(1) instead of true so you don't have to put wait(1) in your code.
    if hcount == 60 then -- checks to see if hcount is a minute or not
        h.Text = "1:00"
    elseif hcount == 0 then
        h:Remove()
        Endmatch() -- you have to call the function inside of the loop or else the look will keep going
    else
        h.Text = ("0:"..hcount)
        hcount = hcount - 1
    end
end

function Endmatch()
 game.Players:GetPlayers()  
game.Players.WalkSpeed = 5
 end
0
Careful. If it is less than ten, it's going to look like, "0:9", "0:8", etc DigitalVeer 1473 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Issues

A couple of issues I see here:

1.) You are calling a function before it has been declared

2.) You are trying to set the walkspeed of a Service [Players]

3.) Although this isn't an error, it certainly is an issue. You can easily create a loop to get everything shorter!

4.) Don't use :Remove(), Get into a practice of using :Destroy()



function EndMatch() for _,v in pairs(game.Players:GetPlayers()) do v.Character["Humanoid"].WalkSpeed = 5 end end local h= script.Parent h.Text = "1:00" wait(1) for i = 59,0,-1 do if i >= 10 then h.Text = "0:"..i elseif i < 10 then h.Text = "0:0"..i end wait(1) end h:Destroy() EndMatch()

Links To Help

http://wiki.roblox.com/index.php?title=Loops#For

http://wiki.roblox.com/index.php?title=API:Class/Player

Answer this question