How do I make a car that you can get hit by

so im making a game with a bunch of badges/easter eggs and im stumped now. i wanna make a road where cars pass by and you can get hit by said cars (like in be dead forever simulator) if anyone knows how to a reply is heavily appreciated

1 Like

Well, what you could possibly do is create a very thin transparent part that is at the front of the car, and utilize Part.Touched Event which fires when the part is touched by another object, you can also get the parent of the part that touched it, therefore you can do something like

Part.Touched:Connect(function(t_Part)
     if t_Part.Parent:FindFirstChild("Humanoid") then
          print("Part hit a humanoid!")
          return
     end
     print("Part wasnt a humanoid!")
end)

Or something along those lines, you can also use the technique of getting the character from the touching part to do some sort of effect, like ragdolling

1 Like

tysm for this, ill be sure to try it

No problem! And please, look on the API reference: BasePart | Roblox Creator Documentation so you can understand how to use it, its very important in scripting!

:hidere:

1 Like

.Touched will definitely work but will probably come with various drawbacks like stutter/lack of smoothness. Raycasting (Raycasting | Roblox Creator Documentation) provides a better alternative for most use cases. It’s marginally more complicated though (and may use more resources, although I haven’t comparatively benchmarked either).