Brick = game.Workspace.Brick
function FallThrough()
if Brick.Transparency = 1 then
Brick.CanCollide = False
end
FallThrough()
Shouldn't this work?
Brick = game.Workspace.Brick
function FallThrough()
if Brick.Transparency = 1 then
Brick.CanCollide = False
end
FallThrough()
Shouldn't this work?
Calling the function only once will only make it run once. Using the Changed event will call the function every time any property of the brick changes.
local Brick = Game.Workspace.Brick
Brick.Changed:connect(function(prop)
if prop == "Transparency" then
if Brick.Transparency >= 1 then
Brick.CanCollide = false
else
Brick.CanCollide = true
end
end
end)
This is a smart use of the Changed event, though stating what was wrong before (syntax) and why you changed the form really should be in your answer
if Brick.Transparency = 1 then
Brick.CanCollide = False
You forgot something here, you need to and an end to the false statement, and make false lowercase.
if Brick.Transparency = 1 then
Brick.CanCollide = false
end
Here's the full script:
Brick = game.Workspace.Brick
function FallThrough()
if Brick.Transparency = 1 then
Brick.CanCollide = false
end
end
FallThrough()
It didn't work. I put it in a separate script alongside another script to make transparency generally fade from 0-1 over the course of 1 second. Then the script waits 2 seconds and the brick reverts back to Transparency=0. For some reason once the block reaches transparency = 1, this script won't work
You Failed an if and then Statement
and Forgot to Add an End
Brick = game.Workspace.Brick
function FallThrough()
if Brick.Transparency == 1 then
Brick.CanCollide = False
end
end
FallThrough()
There you go.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Make sure false is lowercase