How can i make a brick become unanchored if a player touches the brick not click?
✓ ANSWER ACCEPTED
How can i make a brick become unanchored if a player touches the brick not click?
1 answer
✓ Accepted answer
Use the .Touched Event and change part's property Anchored to false.
Here's an example :
local Debounce = false
local Part = Instance.new("Part") --Making part
Part.Position = Vector3.new(0,5,0) --Setting position
Part.Anchored = true --Anchored to true so the part "float" in air
Part.Parent = game.Workspace --Parent to Workspace so the part become visible
Part.Touched:Connect(function(Hit) --When the part is touched then this function runs
if Hit.Parent:IsA("Model") then --Checking if the parent of the object that touched our part is a model
if Hit.Parent:FindFirstChild("Humanoid") then --Checking if the model have a humanoid , if yes then it's a player (or a npc)
if not Debounce then --Using a debounce because the .Touched event fire every time the object that touched the part moves
Part.Anchored = false --Setting Anchored to false so the part falls
Debounce = true --Setting the debounce to true
end
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
touched events
Also, make an attempt before just asking "How can I ________?"