Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Part touching part?

Asked by 8 years ago

Hello guys.

I have this script, but how can I make it so that it detects other parts, and not just a player?

while true do
    script.Parent.CFrame = script.Parent.CFrame +Vector3.new(0.1,0,0)
    wait()
end

script.Parent.Touched:connect(function(hit)
    print(hit.Name .. " was touched")
end)

Thanks

0
Your script is correct. I tested it and it does what you want. Mokiros 135 — 8y
0
Will it work for something moving? As in, moving using vector3 AgentL3r 40 — 8y
0
Well, maybe, but if you "teleport" part using CFrame its most likely won't work. And it won't work for anchored parts too i suppose. Mokiros 135 — 8y
0
That was the problem. Any way to do it with anchored parts? AgentL3r 40 — 8y
View all comments (2 more)
0
If its a projectile that you're trying to make move consider using BodyVelocity instead of CFrame neoG457 315 — 8y
0
Well, what I'm trying to do is when this part touches something, the part it touches becomes unanchored. AgentL3r 40 — 8y

Answer this question