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

How could I detect if a car hits one other?

Asked by 4 years ago

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!

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. Farsalis 369 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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)
0
Sorry, but where would you put it? clock_work7 0 — 4y
0
I'd put it in ServerScriptStorage, but you can put it in Workspace if you want. youtubemasterWOW 2741 — 4y
Ad

Answer this question