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

6 comments

0

Your script is correct. I tested it and it does what you want.

0

Will it work for something moving? As in, moving using vector3

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.

0

That was the problem. Any way to do it with anchored parts?

0

If its a projectile that you're trying to make move consider using BodyVelocity instead of CFrame

0

Well, what I'm trying to do is when this part touches something, the part it touches becomes unanchored.