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
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 16 Oct 2012 12:45 PM |
| Did you connect the function? |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 16 Oct 2012 01:05 PM |
| You spelled Lighting wrong... |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 16 Oct 2012 01:56 PM |
| Don't use a connection, use a call. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 16 Oct 2012 04:16 PM |
function bob() end
bob() --This is calling a function |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|