Hey, so I was wondering how would I make a tool that when touches a part it makes it unanchored. I have been trying to wrap my head around some time now and I can’t really find anything on Youtube or Devforum, any help is appreciated.
You can use the Touched
event for that!
1 Like
I have tried using a .Touched
event but it doesn’t really seem to work, or atleast my variant of code.
Hm, could we see the script then? You probably mistyped something
Follow the steps:
-
insert script in your part
-
Make a touched event in the script
-
Check if the player is equipped with the tool
-
unanchor the part
local part = script.Parent -- Place this script directly inside the part the tool will touch.
part.Touched:Connect(function(hit) -- Checks if something is touching it
if hit:FindFirstAncestorWhichIsA("Tool") then -- Checks if the thing touching it is the child of a tool
if hit:FindFirstAncestorWhichIsA("Tool").Name = "Your Tool's Name" -- Checks if it's the correct tool
part.Anchored = false
end
end
end)