CanCollide is not working for my script

Hello there,

  1. I’m trying to make my part Turn on & Off when it’s day and night.

  2. My script doesn’t do anything to make it happen, If anyone could help me out that would be great.

local Door = script.Parent


while true do
   wait(0.1)
if game.Lighting:GetMinutesAfterMidnight() > 6 * 60 then
		
		Door.CanCollide.Enabled = false

   end

if game.Lighting:GetMinutesAfterMidnight() > 18 * 60 then
		
		Door.CanCollide.Enabled = true

    end
end

Idk what I’m doing wrong for it to work :confused:

Official_Simulation

Okay, i haven’t used cancollide for a year now but as I recall you don’t need enabled, so try CanCollide = false. Also lmk if there are any errors in the output

I will try that to see if it worked.

1 Like

It Never worked sorry Is there anything else that’s wrong?

It Worked! Thank you for that I just forgot to add Door.CanCollide = true.

1 Like