Detecting if a part hits the ground

I’ve made shell ejection for my gun system, and I’d like to make it so if a bullet casing hits the ground it plays the usual bullet hitting the floor sound, however I am unsure as to how I could do this.


is the ground in your game terrain or a part?

It’s a part for now since it’s still in early development, but I might use terrain in the future.

You could either use .Touched or raycast down towards the floor.

I don’t really use raycasts since I don’t know how to use them, so maybe a .Touched event would be best for me.

But I still don’t know how I’d do it.

local Workspace = workspace
local Baseplate = Workspace.Baseplate --Reference to 'floor' part.

local function OnTouched(OtherPart)
	if OtherPart ~= Baseplate then return end --Ignore if the part touched something other than the 'floor'.
	print("Hello world!")

local Part ="Part")
Part.CFrame =, 100, 0)
Part.Touched:Connect(OnTouched) --Connect part's 'Touched' event/signal.
Part.Parent = Workspace --Spawn the part.