Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How could I detect if a car hits one other?

Hey guys, so I am making a game that needs a script that tells if a car hits another car. I'm new to this site and my friend (over Roblox) told me that this is a good site to ask, sorry that I don't have a starter script, I don't know how to start and what I should deal with first! It's a car games type of game. Thanks!

1 comment

0

Be more specific, with two cars; WOW's Answer Works. But with multiple different cars, e.g. More than 3; and different variations of Cars. It can look a lot different.

1 answer

Something that I would use is this. I'm not sure if it would work for you though.

local car1 = workspace.Car1 -- Change Car1 & Car2 to the names of your cars
local car2 = workspace.Car2

car1.Touched:Connect(function(hit)
	if hit.Parent.Name == tostring(car2.Name) then 
		print("Two cars have hit one another.")
	end
end)

2 comments

0

Sorry, but where would you put it?

0

I'd put it in ServerScriptStorage, but you can put it in Workspace if you want.

This discussion is preserved as it was. New answers, comments, and votes are closed.