Aaroncy
|
  |
| Joined: 15 Nov 2012 |
| Total Posts: 3552 |
|
|
| 16 Oct 2015 08:37 AM |
| im working on a timer for my game, then I want it to make a message who won the game... |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2015 08:50 AM |
Details, anyways for the timer. You would have an gui that displays time i guess. For now lets assume it's name is Status, and that it is in StarterGui, and that we have an NumberValue named count in Replicated storage, an server script:
local repstore = game:WaitForChild("ReplicatedStorage") local counter = repstore:WaitForChild("Counter")
counter.Value = 90 -- Time
while wait(1) do for i,v in pairs(game.Players:GetPlayers()) do counter.Value = counter.Value - 1 local gui = v.Playergui:WaitForChild("ScreenGui") local status = gui:FindFirstChild("Status") status.Text = "Mesagge here", counter.Value end
Blindly scripter.
- "I say no because yes is overrated" |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2015 08:51 AM |
Blindly scripted*
- "I say no because yes is overrated" |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Oct 2015 09:00 AM |
Well, how? I'm not too good at efficient scripts, any pin points? Thanks!
- "I say no because yes is overrated" |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2015 10:07 AM |
dont use loops facedesk
i make u math.sqrt() |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2015 10:30 AM |
Numerical for loops instead? They are still loops but they are more efficient.
local repstore = game:WaitForChild("ReplicatedStorage") local counter = repstore:WaitForChild("Counter")
counter.Value = 90 -- Time
while wait(1) do for i,v in pairs(game.Players:GetPlayers()) do repeat counter.Value = counter.Value - 1 local gui = v.Playergui:WaitForChild("ScreenGui") local status = gui:FindFirstChild("Status") status.Text = "Mesagge here", counter.Value until counter.Value = 0 end
Now it stops, better? Anyways don't just discount all loops, i guess forever looping loops are costy. But nontheless usefull for repeating, for example an round cyclus, or doing something until an condition is met. Don't quote me on this.
- "I say no because yes is overrated" |
|
|
| Report Abuse |
|
|