|
| 20 Sep 2014 12:26 PM |
part = game.Workspace.hi h=game.StarterGui.ScreenGui.Frame.Timer timer=30
ding = game.Workspace.ding
while wait(1) and timer > 0 do timer=timer -1 h.Text="INTERMISSION "..timer.."" timerthing = coroutine.create(function() for _,v in pairs(game.Players:GetPlayers()) do local PlayerGui = v:findFirstChild("PlayerGui") PlayerGui.ScreenGui.Frame.Timer.Text = ""..h.Text.."" end end) if timer == 0 then p = ding:Clone() ding:Destroy() p.Parent = game.Players.LocalPlayer.Character.Head p:Play() h.Text="CHOOSING MAP!" timerthing = coroutine.create(function() for _,v in pairs(game.Players:GetPlayers()) do local PlayerGui = v:findFirstChild("PlayerGui") PlayerGui.ScreenGui.Frame.Timer.Text = ""..h.Text.."" end end) wait(1) game.Players.LocalPlayer.Character.Torso.CFrame = CFrame.new(Vector3(part.Position))
end end
For some reason you cant see the timer change in the players playergui, I have been trying to fix this for days, can someone help me? |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2014 12:27 PM |
whoops, forgot this
part = game.Workspace.hi h=game.StarterGui.ScreenGui.Frame.Timer timer=30
ding = game.Workspace.ding
while wait(1) and timer > 0 do timer=timer -1 h.Text="INTERMISSION "..timer.."" timerthing = coroutine.create(function() for _,v in pairs(game.Players:GetPlayers()) do local PlayerGui = v:findFirstChild("PlayerGui") PlayerGui.ScreenGui.Frame.Timer.Text = ""..h.Text.."" end end) if timer == 0 then p = ding:Clone() ding:Destroy() p.Parent = game.Players.LocalPlayer.Character.Head p:Play() h.Text="CHOOSING MAP!" timerthin = coroutine.create(function() for _,v in pairs(game.Players:GetPlayers()) do local PlayerGui = v:findFirstChild("PlayerGui") PlayerGui.ScreenGui.Frame.Timer.Text = ""..h.Text.."" end end) wait(1) game.Players.LocalPlayer.Character.Torso.CFrame = CFrame.new(Vector3(part.Position))
end end timerthing() timerthin()
there we go |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 20 Sep 2014 02:38 PM |
Coroutines are ran with the resume function, unless you use coroutine.wrap then you call it like this
coroutine.resume(functionName) |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2014 02:40 PM |
Personnaly I like to bind these 2
coroutine.resume(coroutine.create(function() --Code end))
-- this runs instantly |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2014 02:58 PM |
| Now when ever the player leaves and rejoins the timer starts over. Can I fix this by adding a player added function in the coroutine? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
| 20 Sep 2014 03:52 PM |
The OP is so needy.
Well then make a timer module. Why not try to fix it yourself? |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2014 03:55 PM |
| Thats what im trying to do.. and nothing is working -.- |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2014 04:08 PM |
Well instead of doing a procedural approach, try the OOP approach.
local Timer = {} Timer.new = function(amount) local this = {} this.Cur_Time = 0 this.Time = amount this.reset = function(self, amt) self.Time = amt self.Cur_time = 0 end this.isTime = function(self) return self.Cur_Time >= self.Time end this.tick = function(self, amt) self.Cur_Time = self.Cur_Time + amt wait(amt) end return this end
local Tiempo = Timer.new(5)
while true do Tiempo:tick(0.3) print "Hello" if(Tiempo:isTime())then break end end
print "Finito" |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2014 08:09 PM |
part = game.Workspace.hi h=game.StarterGui.ScreenGui.Frame.Timer timer=30
ding = game.Workspace.ding
while wait(1) and timer > 0 do timer=timer -1 h.Text="INTERMISSION "..timer.."" timn = coroutine.resume(coroutine.create(function() for _,v in pairs(game.Players:GetPlayers()) do PlayerGui = v:findFirstChild("PlayerGui") PlayerGui.ScreenGui.Frame.Timer.Text = ""..h.Text.."" end end))
if timer == 0 then p = ding:Clone() ding:Destroy() p.Parent = game.Players.LocalPlayer.Character.Head p:Play() h.Text="CHOOSING MAP!" tim = coroutine.resume(coroutine.create(function() for _,v in pairs(game.Players:GetPlayers()) do PlayerGui = v:findFirstChild("PlayerGui") PlayerGui.ScreenGui.Frame.Timer.Text = ""..h.Text.."" end end)) wait(5)
end end timn() tim()
For some reason the time isnt the same for everyone,so one players tim is 17 and the others might be 9 or something? How would i fix this? |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Sep 2014 04:04 PM |
This is what I have now
part = game.Workspace.hi h=game.StarterGui.ScreenGui.Frame.Timer timer=30
ding = game.Workspace.ding
while wait(1) and timer > 0 do timer=timer -1 h.Text="INTERMISSION "..timer.."" timn = coroutine.resume(coroutine.create(function() for i,v in pairs(game.Players:GetPlayers()) do PlayerGui = v:findFirstChild("PlayerGui") i = PlayerGui.ScreenGui.Frame.Timer.Text == ""..h.Text.."" end end)) end
if timer == 0 then p = ding:Clone() ding:Destroy() p.Parent = game.Players.LocalPlayer.Character.Head p:Play() h.Text="CHOOSING MAP!" tim = coroutine.resume(coroutine.create(function() for i,v in pairs(game.Players:GetPlayers()) do PlayerGui = v:findFirstChild("PlayerGui") i = PlayerGui.ScreenGui.Frame.Timer.Text == ""..h.Text.."" end end)) end wait(5)
timn() tim()
but now the timer wont go in player gui can someone help! |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 22 Sep 2014 04:39 PM |
| It has been 2 days no answer... |
|
|
| Report Abuse |
|
|
| |
|
| |
|