|
| 14 Mar 2014 12:14 PM |
I'm making a timer script, like a terminal, that when it is touched, the timer starts. And if the timer reaches '10,' then a message will pop up informing everyone the teamcolor that held the terminal for the required time. It isn't working AT ALL. Nothing works, I have no idea why. Any help?
---------------------------------------------- owning = script.Parent.OwningTeam time = script.Parent.Time
function touched(hit) if not hit or not hit.Parent then return end local p = game.Players:GetPlayerFromCharacter(hit.Parent) if not p then return end if owning.Value ~= p.TeamColor then owning.Value = p.TeamColor script.Parent.BrickColor = p.TeamColor time.Value = 0 end end
function checkifwin() if time.Value >= 10 then msg = Instance.new("Message") msg.Text = "The "..owning.Value.." team has won" msg.Parent = game.Workspace msg.Name = "Hint" wait(20) game.Workspace.Hint:Destroy() end end
coroutine.wrap(function() -- This will make a coroutine. while wait(1) do time.Value = time.Value + 1 end end)()
---------------------------------------------
|
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 12:18 PM |
Oh, and there isn't anything in output, unless this is somehow related to the script:
12:17:28.775 - Argument 1 missing or nil |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 12:21 PM |
I don't know what your trying to do but here is how I make my timers:
Ticks = 0 --Declares variable inGame = false
function Timer(Ticks) for i = 1, #Ticks do if inGame == false then return end Ticks = Ticks - 1 wait(1) end inGame = false end
while wait() do --Also going rounds
for i = 1, 5 do --Intermission wait(1) end
inGame = true --Get started so put variable to true
Ticks = 15 --Number of ticks in game
newTimer = coroutine.create(Timer) --Start timer coroutine.resume(Timer, Ticks) end |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 12:25 PM |
What it is supposed to do- When it is touched, the timer starts. If the timer is not touched again by the other team within 10 seconds, a message pops up telling everyone that the team won. So basically, it is a terminal/flag for a fort. |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Mar 2014 12:29 PM |
| Oh my script above is perfect for this, but I don't have time to answer fully right now, gimme 20 minutes, because I have to run somewhere, if nobody else answers by then... I will... |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|