Hello. I am a very basic scripter that is trying to learn without any videos (they don’t help me very much). My question is why doesn’t it create a click detector as a child of Brick2. Also, Brick1’s transparency is 1. Here is my code: (keep in mind it may be simple for you, but difficult for me).
local Brick1 = game.Workspace.BrickMaterial
local Brick2 = game.Workspace.BrickColorChangingScript
if Brick1.Transparency == 1 then
Brick2.new("ClickDetector")
end
you are adding .new to something that is not BrickColorChangingScript, I assume its not a ClickDetector
You might be able to do this
Put inside a click detector
local Brick1 = game.Workspace.BrickMaterial
local Brick2 = game.Workspace.BrickColorChangingScript
script.Parent.MouseClick:Connect(function()
if Brick1.Transparency == 1 then
print("yes")
end
end)
To add or Create an Instance:
if Brick1.Transparency == 1 then
local CD = Instance.new("ClickDetector", script.Parent)
end