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 » Game Design
Home Search
 

Re: A little script

Previous Thread :: Next Thread 
laika2012 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. laika2012
Joined: 18 Dec 2011
Total Posts: 607
10 Apr 2017 12:38 PM
Not working still.


#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼")
Report Abuse
CitCatCarrie is not online. CitCatCarrie
Joined: 28 Jan 2014
Total Posts: 426
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 is not online. 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 is not online. laika2012
Joined: 18 Dec 2011
Total Posts: 607
10 Apr 2017 12:46 PM
Oh thx


#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼")
Report Abuse
laika2012 is not online. 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
CitCatCarrie is not online. CitCatCarrie
Joined: 28 Jan 2014
Total Posts: 426
10 Apr 2017 12:49 PM
Did you also fix the "game.Lighting.TimeOfDay == 20"? :P
Report Abuse
laika2012 is not online. laika2012
Joined: 18 Dec 2011
Total Posts: 607
10 Apr 2017 12:50 PM
Yeah


#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼")
Report Abuse
laika2012 is not online. 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 is not online. 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 is not online. laika2012
Joined: 18 Dec 2011
Total Posts: 607
10 Apr 2017 01:02 PM
Look my last reply


#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼")
Report Abuse
CitCatCarrie is not online. CitCatCarrie
Joined: 28 Jan 2014
Total Posts: 426
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
Snowskateer is not online. Snowskateer
Joined: 06 Dec 2011
Total Posts: 4647
10 Apr 2017 01:23 PM
you're trying to assign a cframe value to a vector3

use Vector3.new() instead
Report Abuse
laika2012 is not online. laika2012
Joined: 18 Dec 2011
Total Posts: 607
10 Apr 2017 01:24 PM
k


#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼")


#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼")
Report Abuse
laika2012 is not online. laika2012
Joined: 18 Dec 2011
Total Posts: 607
10 Apr 2017 01:25 PM
It asks to break script.


#code print("𝓵𝓪𝓲𝓴𝓪2012 𝔀𝓪𝓼 𝓱𝓮𝓻𝓮 𝓴𝓲𝓭𝓼")
Report Abuse
Snowskateer is not online. Snowskateer
Joined: 06 Dec 2011
Total Posts: 4647
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
CitCatCarrie is not online. CitCatCarrie
Joined: 28 Jan 2014
Total Posts: 426
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
CitCatCarrie is not online. CitCatCarrie
Joined: 28 Jan 2014
Total Posts: 426
10 Apr 2017 01:29 PM
But if that works too, then that's fine C:
Report Abuse
drysty is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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