How would I script a collision check between a object and part? The model being model1 and the object being a declared as theobject.

if model1 (collides with) theobject

I have no idea on what the collides with collision check should be and I can't seem to find it anywhere. Any help much appreciated.

9 comments

0

As long as the objects aren't being CFramed into eachother (and collide because of roblox physics/body objects) then you could use the Touched event to detect collision.

0

Like model1.Touched:connect(function(theobject)?

0

for _, part in pairs(model1:GetChildren()) do part.Touched:connect(function(hit) print(part.Name.. " collided with ".. hit.Name) end) end

0

???

0

Whenever a part that's child of "model1" is touched, "PartName collided with HitName" will be printed.

0

touched by what?

0

By another part.

0

How can this be changed so it only happens when a select part touches it?

0

local object = game.Workspace.Part; for _, part in pairs(model1:GetChildren()) do; part.Touched:connect(function(hit); if hit == object then; print(part.Name.. " collided with ".. hit.Name); end; end); end