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
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Any reason this script doesn't work?

Previous Thread :: Next Thread 
Bzrk262 is not online. Bzrk262
Joined: 27 Dec 2012
Total Posts: 23
14 Nov 2015 02:09 PM
function onPlayerEntered(newPlayer)

local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

local secs = Instance.new("IntValue")
secs.Name = "Seconds"
secs.Value = 0

local mins = Instance.new("IntValue")
mins.Name = "Minutes"
mins.Value = 0

local hrs = Instance.new("IntValue")
hrs.Name = "Hours"
hrs.Value = 0

secs.Parent = stats
mins.Parent = stats
hrs.Parent = stats

stats.Parent = newPlayer

while true do
wait(1)
secs.Value = secs.Value + 1
end
while true do
wait(60)
mins.Value = mins.Value + 1
secs.Value = secs.Value - 60
end
while true do
wait(1440)
hrs.Value = hrs.Value + 1
mins.Value = mins.Value - 60
end
end

game.Players.ChildAdded:connect(onPlayerEntered)
Report Abuse
Bzrk262 is not online. Bzrk262
Joined: 27 Dec 2012
Total Posts: 23
14 Nov 2015 02:10 PM
The main problem is the 'while true do' bits where it doesn't subtract or add.

Note: I have also tried 'if' statements and they don't work either.
Report Abuse
Bzrk262 is not online. Bzrk262
Joined: 27 Dec 2012
Total Posts: 23
14 Nov 2015 02:31 PM
Bump

(If I can)
Report Abuse
MasterAskav is not online. MasterAskav
Joined: 10 Nov 2015
Total Posts: 148
14 Nov 2015 02:31 PM
game.Players.PlayerAdded:connect(onPlayerEntered)
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
14 Nov 2015 02:31 PM
It gets stuck on the first while true do and never goes onto the others
Report Abuse
Bzrk262 is not online. Bzrk262
Joined: 27 Dec 2012
Total Posts: 23
14 Nov 2015 02:33 PM
I'll condense it into one and see if that works.
Report Abuse
MasterAskav is not online. MasterAskav
Joined: 10 Nov 2015
Total Posts: 148
14 Nov 2015 02:37 PM
or use corotines
Report Abuse
Bzrk262 is not online. Bzrk262
Joined: 27 Dec 2012
Total Posts: 23
14 Nov 2015 02:38 PM
Weird, that works now but didn't work when I did it before. Must have done something wrong!

(I'll post the working script here if anyone wants to use something similar)
Report Abuse
Bzrk262 is not online. Bzrk262
Joined: 27 Dec 2012
Total Posts: 23
14 Nov 2015 02:42 PM
The working script:
http://www.roblox.com/item.aspx?id=319996371

The game its used in/example:
http://www.roblox.com/games/256942477/Paint-The-Town-Red-v1-06
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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