Still have questions? Join our Discord server and get real time help.
0

# I want to make touching by tool but it works when I'm touching without tool. How can I fix that?

Asked by 15 days ago

Hello! I made a scripting that make: When door touched by tool, door anchored = false. It works but when I have a tool in invetnory and I'm touching the door by body it also works. How can I fix that?

Script: local function onTouch(doorHouse)

game.Workspace.DoorHouse.Anchored = false

end game.Workspace.DoorHouse.Touched:Connect(onTouch)

0
You need an [if statement] in order to make sure only the tool is allowed to operate within the Touched event. Serpawh -4 — 15d

0
Kami_Yo 67
15 days ago
Edited 15 days ago

You need a check to make sure it's a tool

if doorHouse:IsA("Tool") then

end


Or if just a part of the tool hits the door.

if doorHouse.Parent:IsA("Tool") then

end

0
I made something like that: local Ram = game.Workspace.Ram local function onTouch(doorHouse) if doorHouse:IsA("Ram") then game.Workspace.DoorHouse.Anchored = false end game.Workspace.DoorHouse.Touched:Connect(onTouch) and output showed an error: "Workspace.AykoOfficial.Ram.Handle.LocalScript:10: 'end' expected (to close 'function' at line 3) near '<eof>'" AykoOfficial -6 — 15d