laika2012
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 607 |
|
|
| 10 Apr 2017 12:18 PM |
I need to make when it's night it closes and when it's day it opens help der (Script) local d = script.Parent local l = game.Ligthing while true do if game.Lighting.TimeOfDay == 10 then wait(1) d.Position = CFrame.new(135.928, 14.376, 65.969) elseif game.Lighting == 20 then wait(1) d.Position = CFrame.new(136.228, 7.476, 65.969) end end
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼") |
|
|
| Report Abuse |
|
|
Calviski
|
  |
| Joined: 03 Dec 2016 |
| Total Posts: 209 |
|
|
| 10 Apr 2017 12:26 PM |
| are u making it so a wall or door or something opens/closes at certain times |
|
|
| Report Abuse |
|
|
laika2012
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 607 |
|
|
| 10 Apr 2017 12:27 PM |
Door, it opens when it's day and closes when it's night.
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼") |
|
|
| Report Abuse |
|
|
Calviski
|
  |
| Joined: 03 Dec 2016 |
| Total Posts: 209 |
|
|
| 10 Apr 2017 12:31 PM |
found your issue
"local l = game.Ligthing"
is supposed to be
"local l = game.Lighting" |
|
|
| Report Abuse |
|
|
laika2012
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 607 |
|
|
| 10 Apr 2017 12:32 PM |
Oh lol I got looking for this for 30 sec to understand xD
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼") |
|
|
| Report Abuse |
|
|
laika2012
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 607 |
|
|
| 10 Apr 2017 12:38 PM |
Not working still.
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼") |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 12:43 PM |
| I think your problem is that instead of "if game.Lighting.TimeOfDay == 10 then", you should put "if game.Lighting.TimeOfDay == "10:00:00" then". |
|
|
| Report Abuse |
|
|
Calviski
|
  |
| Joined: 03 Dec 2016 |
| Total Posts: 209 |
|
|
| 10 Apr 2017 12:45 PM |
@Cit
I was thinking about that
but I couldn't remember the proper way of putting it lol |
|
|
| Report Abuse |
|
|
laika2012
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 607 |
|
|
| 10 Apr 2017 12:46 PM |
Oh thx
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼") |
|
|
| Report Abuse |
|
|
laika2012
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 607 |
|
|
| 10 Apr 2017 12:47 PM |
Ok, it's still up, any more ideas?
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼") |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 12:49 PM |
| Did you also fix the "game.Lighting.TimeOfDay == 20"? :P |
|
|
| Report Abuse |
|
|
laika2012
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 607 |
|
|
| 10 Apr 2017 12:50 PM |
Yeah
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼") |
|
|
| Report Abuse |
|
|
laika2012
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 607 |
|
|
| 10 Apr 2017 12:52 PM |
local d = script.Parent local l = game.Lighting if l.TimeOfDay == game.Lighting.TimeOfDay == "10:00:00" then wait(1) d.Position = CFrame.new(135.928, 14.376, 65.969) elseif l.TimeOfDay == game.Lighting.TimeOfDay == "20:00:00" then wait(1) d.Position = CFrame.new(136.228, 7.476, 65.969) end
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼") |
|
|
| Report Abuse |
|
|
Nitro509
|
  |
| Joined: 27 Jun 2010 |
| Total Posts: 11170 |
|
|
| 10 Apr 2017 01:01 PM |
Be careful with "while true do" loops. They can cause chaos quickly if you're working on other scripts.
|
|
|
| Report Abuse |
|
|
laika2012
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 607 |
|
|
| 10 Apr 2017 01:02 PM |
Look my last reply
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼") |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 01:19 PM |
This is how I would do it:
while true do if game.Lighting.TimeOfDay == "10:00:00" then wait(1) script.Parent.Position = CFrame.new(135.928, 14.376, 65.969) elseif game.Lighting.TimeOfDay == "20:00:00" then wait(1) script.Parent.Position = CFrame.new(136.228, 7.476, 65.969) else end end |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 01:23 PM |
you're trying to assign a cframe value to a vector3
use Vector3.new() instead
|
|
|
| Report Abuse |
|
|
laika2012
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 607 |
|
|
| 10 Apr 2017 01:24 PM |
k
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼")
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼") |
|
|
| Report Abuse |
|
|
laika2012
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 607 |
|
|
| 10 Apr 2017 01:25 PM |
It asks to break script.
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼") |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 01:28 PM |
since no one here is actually fixing it, but only making it worse, heres a fixed version:
while wait() do if game.Lighting.TimeOfDay == "10:00:00" then wait(1) script.Parent.CFrame = CFrame.new(Vector3.new(135.928, 14.376, 65.969)) elseif game.Lighting.TimeOfDay == "20:00:00" then wait(1) script.Parent.CFrame = CFrame.new(Vector3.new(136.228, 7.476, 65.969)) end end
|
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 01:28 PM |
Oops. My mistake. Roblox Studio doesn't like while loops that repeat a million times every second or so, which means that you should make it wait after the else part.
Like this:
else wait(1) end |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 01:29 PM |
| But if that works too, then that's fine C: |
|
|
| Report Abuse |
|
|
drysty
|
  |
| Joined: 07 Dec 2013 |
| Total Posts: 1913 |
|
|
| 10 Apr 2017 01:43 PM |
Ive been working on this script all this time. Now you have it.
e.e |
|
|
| Report Abuse |
|
|
Inductive
|
  |
| Joined: 28 May 2012 |
| Total Posts: 6480 |
|
|
| 10 Apr 2017 02:31 PM |
| Trying game.Lighting.TimeOfDay > 10 and game.Lighting.TimeOfDay < 20, and game.Lighting.TimeOfDay > 20 or game.Lighting.TimeOfDay < 10 as your conditions. |
|
|
| Report Abuse |
|
|
laika2012
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 607 |
|
|
| 10 Apr 2017 02:35 PM |
Thanks to snow it finally worked111
#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼") |
|
|
| Report Abuse |
|
|