Script Error in my game

So I have this blue block in my game right, and I want it to unanchor when you step on it. So I wrote local function bruh()

game.Workspace.Blue.Anchored = false

game.Workspace.Blue.Touched:Connect(bruh)

end

And it doesn’t work. What’s wrong with it?

the line that fires it must be outside of the function itself

function bruh()
game.Workspace.Blue.Anchored = false
end
game.Workspace.Blue.Touched:Connect(bruh)

You can also do something like this to keep the code better organized

game.Workspace.Blue.Touched:Connect(function()
game.Workspace.Blue.Anchored = false
end)
2 Likes

Thanks man! This helped and now the block falls!

2 Likes