Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

I have a problem with my brick, Please HELP.

Asked by
Yeevivor4 155
10 years ago

I put this script into another brick named "FF5". I want the FallingBrick to unanchor itself after I touch the FF5 brick. Can anyone help me?

print("FallingBrick Script Loaded")

FallingBrick = script.Parent.Parent.FallingBrick



function onTouched(hit)
    local human = hit.Parent.findFirstChild()
    if (human ~= nil) then 
  FallingBrick.CanCollide = false
  FallingBrick.Anchored = true
  wait(0)
  FallingBrick.CanCollide = false
  FallingBrick.Anchored = true -- change this to true to make it Anchored after it falls
end

connection = FallingBrick.Touched:connect(onTouched)
end

~Thank you for reading, Yeevivor4

1 answer

Log in to vote
2
Answered by
AxeOfMen 434 Moderation Voter
10 years ago
print("FallingBrick Script Loaded")
FallingBrick = script.Parent.Parent.FallingBrick

function onTouched(hit)
    local human = hit.Parent.findFirstChild("Humanoid") --Your code is missing the argument to findFirstChild()
    if human then 
        FallingBrick.CanCollide = false --Allow the brick to fall
        FallingBrick.Anchored = false --Allow the brick to fall
    end
end

connection = FallingBrick.Touched:connect(onTouched)
end
0
Thanks for helping! You're so freaking heplful! Yeevivor4 155 — 10y
Ad

Answer this question