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
 

Re: Help would be appreciated.

Previous Thread :: Next Thread 
KanataIzumi7 is not online. KanataIzumi7
Joined: 08 May 2011
Total Posts: 949
10 Jul 2013 11:15 AM
Am I just....over looking something?
They're ALWAYS Collidable..


game.Lighting.Changed:connect(function()
local x = game.Lighting:GetMinutesAfterMidnight()
if x > 360 then
A.CanCollide = true
B.CanCollide = true
C.CanCollide = true
D.CanCollide = true
E.CanCollide = true
elseif x > 1080 then
A.CanCollide = false
B.CanCollide = false
C.CanCollide = false
D.CanCollide = false
E.CanCollide = false
end
end)
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
10 Jul 2013 11:17 AM
Is it all defined? A-E.
Report Abuse
KanataIzumi7 is not online. KanataIzumi7
Joined: 08 May 2011
Total Posts: 949
10 Jul 2013 11:18 AM
Yup.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
10 Jul 2013 11:19 AM
Once it changes keep printing x to see if it actually even reach more than 1080.
Report Abuse
swimeralex is not online. swimeralex
Joined: 07 Mar 2010
Total Posts: 426
10 Jul 2013 11:20 AM
I'm a noob at scripting but...(check the side note)

game.Lighting.Changed:connect(function()
local x = game.Lighting:GetMinutesAfterMidnight()
if x > 360 then
A.CanCollide = true
B.CanCollide = true
C.CanCollide = true
D.CanCollide = true
E.CanCollide = true -- do you need an end after this line?
elseif x > 1080 then
A.CanCollide = false
B.CanCollide = false
C.CanCollide = false
D.CanCollide = false
E.CanCollide = false
end
end)
Report Abuse
KanataIzumi7 is not online. KanataIzumi7
Joined: 08 May 2011
Total Posts: 949
10 Jul 2013 11:20 AM
I did that originally. :S
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
10 Jul 2013 11:21 AM
swim, no. KA, results?
Report Abuse
swimeralex is not online. swimeralex
Joined: 07 Mar 2010
Total Posts: 426
10 Jul 2013 11:21 AM
Also maybe because if the minutes is under 360, the script has no idea what to do. more I look at it, it only checks it once, make it a loop
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
10 Jul 2013 11:23 AM
Changed is basically a loop, but it only fires once something... Well... Changes.
Report Abuse
KanataIzumi7 is not online. KanataIzumi7
Joined: 08 May 2011
Total Posts: 949
10 Jul 2013 11:25 AM
No change. :T
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
10 Jul 2013 11:25 AM
Then I have no idea, :P.
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
10 Jul 2013 11:26 AM
Actually try a while loop instead.
Report Abuse
KanataIzumi7 is not online. KanataIzumi7
Joined: 08 May 2011
Total Posts: 949
10 Jul 2013 11:31 AM
Tried it.....no difference. :S

I'm really confused though, this has NEVER happened for me before.
Report Abuse
swimeralex is not online. swimeralex
Joined: 07 Mar 2010
Total Posts: 426
10 Jul 2013 11:31 AM
I think I got it. Logic error. It won't execute the > 1080 thingy because the >360 is before it.
So lets say it is 1090 minutes, and it runs the first if, (the > 360) it runs it, and everything is true, and ignores the > 1080

Report Abuse
swimeralex is not online. swimeralex
Joined: 07 Mar 2010
Total Posts: 426
10 Jul 2013 11:32 AM
game.Lighting.Changed:connect(function()
local x = game.Lighting:GetMinutesAfterMidnight()
if x > 360 then -- will execute even if x is 1090. because it is still over 360.
A.CanCollide = true
B.CanCollide = true
C.CanCollide = true
D.CanCollide = true
E.CanCollide = true
elseif x > 1080 then -- because the first if was executed, it ignores this.
A.CanCollide = false
B.CanCollide = false
C.CanCollide = false
D.CanCollide = false
E.CanCollide = false
end
end)
Report Abuse
swimeralex is not online. swimeralex
Joined: 07 Mar 2010
Total Posts: 426
10 Jul 2013 11:33 AM
Switching the two if statements should fix it

game.Lighting.Changed:connect(function()
local x = game.Lighting:GetMinutesAfterMidnight()
if x > 1080 then
A.CanCollide = false
B.CanCollide = false
C.CanCollide = false
D.CanCollide = false
E.CanCollide = false
elseif x > 360 then
A.CanCollide = true
B.CanCollide = true
C.CanCollide = true
D.CanCollide = true
E.CanCollide = true
end
end) -- switched it for you
Report Abuse
KanataIzumi7 is not online. KanataIzumi7
Joined: 08 May 2011
Total Posts: 949
10 Jul 2013 11:34 AM
I see, so I need to change the order?
Report Abuse
swimeralex is not online. swimeralex
Joined: 07 Mar 2010
Total Posts: 426
10 Jul 2013 11:35 AM
It should fix the logic error.
Report Abuse
Unsubstantial is not online. Unsubstantial
Joined: 11 Sep 2012
Total Posts: 872
10 Jul 2013 11:38 AM
game.Lighting.Changed:connect(function()
local x = game.Lighting:GetMinutesAfterMidnight()
if x > 360 and x < 1080 then
A.CanCollide = true
B.CanCollide = true
C.CanCollide = true
D.CanCollide = true
E.CanCollide = true
elseif x > 1080 then
A.CanCollide = false
B.CanCollide = false
C.CanCollide = false
D.CanCollide = false
E.CanCollide = false
end
end)
Report Abuse
KanataIzumi7 is not online. KanataIzumi7
Joined: 08 May 2011
Total Posts: 949
10 Jul 2013 11:39 AM
Seems to have worked.
Note to self; Greater values come first. :s
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
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