generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Timer Script not working; Values not changing

Previous Thread :: Next Thread 
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
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
skyboundShovel is not online. skyboundShovel
Joined: 28 Feb 2014
Total Posts: 232
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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
14 Mar 2014 12:29 PM
Bump.
Report Abuse
skyboundShovel is not online. skyboundShovel
Joined: 28 Feb 2014
Total Posts: 232
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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
14 Mar 2014 12:30 PM
Ok.
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
14 Mar 2014 12:41 PM
Bump.
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
14 Mar 2014 01:17 PM
Bump!
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
14 Mar 2014 03:06 PM
Bump.
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
14 Mar 2014 05:21 PM
Bump.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image