Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I have a problem with my brick, Please HELP.

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

✓ Accepted answer
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

1 comment

0

Thanks for helping! You're so freaking heplful!

This discussion is preserved as it was. New answers, comments, and votes are closed.