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 » Scripting Helpers
Home Search
 

TimeOfDay+fog

Previous Thread :: Next Thread 
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
16 Oct 2012 12:39 PM
function TimeFog()

if game.Lighting.TimeOfDay = "18:00:00" then
game.Lighitng.FogEnd = "300"

elseif game.Lighting.TimeOfDay = "4:00:00" then
game.Lighitng.FogEnd = "600"

end
end
end)

Output nothing.
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
16 Oct 2012 12:45 PM
Did you connect the function?
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
16 Oct 2012 12:55 PM
No cause I can't tell if a script needs a connection or not.
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
16 Oct 2012 12:57 PM
function TimeFog()

if game.Lighting.TimeOfDay = "18:00:00" then
game.Lighitng.FogEnd = "300"

elseif game.Lighting.TimeOfDay = "4:00:00" then
game.Lighitng.FogEnd = "600"

end
end
end)

script.Parent:connect(TimeFog)


That doesn't look like I did then connection line right... Am I missing something?
Report Abuse
Justicepaine99 is not online. Justicepaine99
Joined: 31 Aug 2011
Total Posts: 147
16 Oct 2012 01:05 PM
You spelled Lighting wrong...
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
16 Oct 2012 01:09 PM
It need a connection since there is a function

function MrChubbs()
print(MrChubbs.AwesomeLevel)
end


will print nothing BUT

function MrChubbs()
print(MrChubbs.AwesomeLevel)
end

MrChubbs() -- connection

will print some random string of numbers that is as close to infinity as Roblox will allow.
Report Abuse
woot3 is not online. woot3
Joined: 10 Nov 2008
Total Posts: 3599
16 Oct 2012 01:14 PM
function TimeFog()

if game.Lighting.TimeOfDay = "18:00:00" then
game.Lighitng.FogEnd = "300"

elseif game.Lighting.TimeOfDay = "4:00:00" then
game.Lighitng.FogEnd = "600"

end
end

You only need to end the function and the if, elseif uses the same end as the if.
You don't need a ) unless using a closed function.

MrChubbs is calling it a Connection, so something you both need to learn is it's actually known as a "Call"

TimeFog() is what you "call" to run the function.
A connection runs a call.
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
16 Oct 2012 01:19 PM
I said he needed a connection because I assume he isn't just running it once, I was saying to place a connection at the bottom where I called the script.
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
16 Oct 2012 01:20 PM
Called the function*
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
16 Oct 2012 01:28 PM
function TimeFog()

if game.Lighting.TimeOfDay = "18:00:00" then
game.Lighitng.FogEnd = "300"

elseif game.Lighting.TimeOfDay = "4:00:00" then
game.Lighitng.FogEnd = "600"

end
end

script.Parent:connect(TimeFog)

Output: Workspace.Script:3: 'then' expected near '='

So whats wrong?
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
16 Oct 2012 01:30 PM
function TimeFog()

if game.Lighting.TimeOfDay == "18:00:00" then --[[ Two Equals signs for if, while, and for statments.]]
game.Lighting.FogEnd = "300"

elseif game.Lighting.TimeOfDay == "4:00:00" then
game.Lighitng.FogEnd = "600"

end
end

script.Parent:connect(TimeFog)
Report Abuse
woot3 is not online. woot3
Joined: 10 Nov 2008
Total Posts: 3599
16 Oct 2012 01:44 PM
script.Parent:connect(TimeFog) does nothing!
You're connecting to no event.

Just use

TimeFog()
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
16 Oct 2012 01:46 PM
If your refering to me I am just fixing the script he posted for the error he posted.
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
16 Oct 2012 01:49 PM
oh.. Needed 2 equal signs..

Well after fixing a small spelling error of mine..

function TimeFog()

if game.Lighting.TimeOfDay == "18:00:00" then --[[ Two Equals signs for if, while, and for statments.]]
game.Lighting.FogEnd = "300"

elseif game.Lighting.TimeOfDay == "4:00:00" then
game.Lighitng.FogEnd = "600"

end
end

script.Parent.script:Connect(TimeFog)

I noticed that I get an output error that says "Script is not a valid member of Workspace."

Its caused from the Connection line right?
Report Abuse
woot3 is not online. woot3
Joined: 10 Nov 2008
Total Posts: 3599
16 Oct 2012 01:56 PM
Don't use a connection, use a call.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
16 Oct 2012 02:09 PM
You misspelled lighting again. Instead of having a connection just call it.


function FuncName()
print 'yolo'
end

FuncName()

--> yolo


-------------------------
~thedestroyer115, http://www.roblox.com/String-Word-Randomizer-item?id=94754887~
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
16 Oct 2012 02:47 PM
Call? I though thats what the " end) " thing was meant for.
Report Abuse
woot3 is not online. woot3
Joined: 10 Nov 2008
Total Posts: 3599
16 Oct 2012 02:52 PM
) is used to close of an (
You know something is wrong if you have more ( than ) or more ) than (
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
16 Oct 2012 03:04 PM
Thats used to close an anonymous function. Lets say a part is inserted into workspace.


game.Workspace.ChildAdded:connect(function(Object)
print("New object in workspace, "..Object.Name)
end)

--> New object in workspace, Part


-------------------------
~thedestroyer115, http://www.roblox.com/String-Word-Randomizer-item?id=94754887~
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
16 Oct 2012 03:46 PM
So call a function? I'm not even sure If I know what that is.
Report Abuse
woot3 is not online. woot3
Joined: 10 Nov 2008
Total Posts: 3599
16 Oct 2012 04:16 PM
function bob()
end

bob() --This is calling a function
Report Abuse
buddy249950 is not online. buddy249950
Joined: 30 Jun 2016
Total Posts: 3536
16 Oct 2012 04:22 PM
You guys, he spelled lighting wrong on one of the lines. He doesn't need a function at all.
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
16 Oct 2012 04:26 PM
So this?

function TimeFog()

if game.Lighting.TimeOfDay == "18:00:00" then --[[ Two Equals signs for if, while, and for statments.]]
game.Lighting.FogEnd = "300"

elseif game.Lighting.TimeOfDay == "4:00:00" then
game.Lighting.FogEnd = "600"

end
end

TimeFog()

alright no errors... Good.

How do I keep it checking without while true do stuff? I mean I want it to keep checking until its that time of day then change the fog. But its my understanding that "while true do" causes alot of lag.
Report Abuse
koen500 is not online. koen500
Joined: 23 Feb 2011
Total Posts: 2277
16 Oct 2012 04:37 PM
while wait() do
if game.Lighting.TimeOfDay = "18:00:00" then
game.Lighitng.FogEnd = "300"

elseif game.Lighting.TimeOfDay = "4:00:00" then
game.Lighitng.FogEnd = "600"

end
end
Report Abuse
woot3 is not online. woot3
Joined: 10 Nov 2008
Total Posts: 3599
16 Oct 2012 04:38 PM
while true do won't cause a lot of lag when used correctly.
However, you could also used the .Changed event on Lighting.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 2Go to page: [1], 2 Next
 
 
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