When I click on my button, it works but it doesn't get past line 4

  1. What do I want to achieve? I’d like to first off all, fix my code, I was following a tutorial but I’m unsure how to fix it. This

  2. What is the issue? I was following a tutorial but I’m unsure how to fix it. The ButtonPart doesn’t seem to want to work.

  3. What solutions have I tried so far? I tried to re watch the tutorial multiple times, it still has not worked unfortunately.

Here’s the code and some photos:

script.Parent.ClickDetector.MouseClick:Connect(function()
	script.Parent.Parent.DoorPart.Transparency = 0.7
	script.Parent.Parent.DoorPart.CanCollide = false
	script.Parent.ButtonPart.BrickColor = BrickColor.Red()
	wait(1)
	script.Parent.Parent.DoorPart.Transparency = 1
	script.Parent.Parent.DoorPart.CanCollide = true
	script.Parent.ButtonPart.BrickColor = BrickColor.Green()
end)

Video:
robloxapp-20220115-1234561.wmv (2.7 MB)

image

When I click on the button, it should be able to open the door for one second and then close automatically but it does not.

Thank you for the help! :grin:

script.Parent is equal to the model named “ButtonPart”. In your code you attempt to access ButtonPart from ButtonPart which is where your current error is coming from. Also, you are attempting to set the BrickColor of a Model, but Models do not have a BrickColor property. Are you trying to change the color of the parts in ButtonPart?

Thank you so much! It works now! :smiley: