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: Scripting help.

Previous Thread :: Next Thread 
xTimeWasted is not online. xTimeWasted
Joined: 28 May 2015
Total Posts: 13
08 Oct 2016 03:24 PM
Hello, I need help with something.. Basically I'm making roleplaying game and what I want to ### ## background music of bird chirping. But I have done that. However I want it to only be in the mornings.. Easier said, in a specific time and then stops after. Any suggestions ? Please help.
Report Abuse
xTimeWasted is not online. xTimeWasted
Joined: 28 May 2015
Total Posts: 13
08 Oct 2016 03:26 PM
"I want to add birds chirping"
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
08 Oct 2016 03:34 PM
http://wiki.roblox.com/index.php?title=API:Class/Lighting/GetMinutesAfterMidnight
Report Abuse
vexieh is not online. vexieh
Joined: 22 Oct 2009
Total Posts: 3468
08 Oct 2016 03:40 PM
Alternatively, you could create a function to convert TimeOfDay into a number.

local FetchTime = function()
return tonumber(string.sub(game.Lighting.TimeOfDay, 0, 2) .. "." .. string.sub(game.Lighting.TimeOfDay, 4, 5))
end

print(FetchTime())

My TimeOfDay is set to '15:38:00', so FetchTime() would return the 15.38

So then you can just do something like

if(FetchTime() > 9.5)then
Sound:Play()
end


Report Abuse
vexieh is not online. vexieh
Joined: 22 Oct 2009
Total Posts: 3468
08 Oct 2016 03:41 PM
"return the 15.38"
return 15.38* oops


Report Abuse
xTimeWasted is not online. xTimeWasted
Joined: 28 May 2015
Total Posts: 13
08 Oct 2016 04:28 PM
in Fetchtime... May I ask what 9.5 is meant to be?
Report Abuse
Ali365Dash is not online. Ali365Dash
Joined: 26 Jan 2012
Total Posts: 126
08 Oct 2016 04:34 PM
Probably "9:50:00", but might be "9:05:00".


Good scripter, but probably not good enough a builder to be an RBXDev...
Report Abuse
vexieh is not online. vexieh
Joined: 22 Oct 2009
Total Posts: 3468
08 Oct 2016 04:48 PM
9.5 would be 09:50:00, 9.05 would be 09:05:00


Report Abuse
xTimeWasted is not online. xTimeWasted
Joined: 28 May 2015
Total Posts: 13
08 Oct 2016 05:41 PM
Can't I do it easier? by doing

Start = game.workspace.sound:play()
pause = game.workspace.sound:Pause()

while true do

Pause
wait () --Value

Start -- The time when it's morning.

Report Abuse
vexieh is not online. vexieh
Joined: 22 Oct 2009
Total Posts: 3468
08 Oct 2016 05:45 PM
No easier way for doing it other than getting the time


Report Abuse
xTimeWasted is not online. xTimeWasted
Joined: 28 May 2015
Total Posts: 13
08 Oct 2016 05:48 PM
Oh darn.. The time thingy gets too confusing for me for some reason. I guess i'll have to figure an easier way.
Report Abuse
xTimeWasted is not online. xTimeWasted
Joined: 28 May 2015
Total Posts: 13
09 Oct 2016 05:50 AM
I've done this til now but still a problem



local FetchTime = function()
return tonumber(string.sub(game.Lighting.TimeOfDay, 0, 2) .. "." .. string.sub(game.Lighting.TimeOfDay, 4, 5))


end


local function Fetchtime() end

print("FetchTime")

FetchTime() "return 14.00"





if(FetchTime() > 9.05)then
game.Workspace.Sound:Play()
end

When I run the script this error occures

"Workspace.Sound.Script:12: attempt to call a number value"
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