I am trying to make another part move when another is touched by a humanoid, but my script isn't working. Can somebody explain why?
local Part1 = workspace.Part1
local Part2 = workspace.Part2
local function onTouch(Part2)
if Part2.Parent:FindFirstChild("Humanoid") then
wait()
for i= 1, 300 do
Part1.Position = workspace.Part1.Position * CFrame.new(0,-0.1,0)
wait()
end
for i= 1, 300 do
Part1.Position = workspace.Part1.Position * CFrame.new(0,0.1,0)
wait()
end
end
end
Part2.Touched:Connect(onTouch)

1 comment
You forgot the ) at the end