Checking if part hits ground or player?

Title explains it all, how would i make it so if the part hits the ground or player it dissapears?
Thanks!

1 Like

Well So You Can Do:

-- If Part Touched Player.
local Part = workspace.Baseplate

Part.Touched:Connect(function(hit)
	if hit.Name == game.Players.LocalPlayer.Name then
		-- blah blah blah
	end
end)

-- If Part Touched Ground

local Part = workspace.Baseplate

Part.Touched:Connect(function(hit)
	if hit.Name == "Your Part Name" then
		-- blah blah blah
	end
end)

-- Also You Can Do Tag Every Part You Need It To Be Assigned As "Ground":

```lua
local CollectionService = game:GetService("CollectionService")

local Baseplate = workspace.Baseplate

CollectionService:AddTag(Baseplate, "Ground") -- Adding Specific Tag To The Baseplate

Baseplate.Touched:Connect(function(hit)
	for _, instance in pairs(CollectionService:GetTagged("Ground")) do
		if hit.Name == instance.Name then
			-- blah blah blah
		end
	end
end)
2 Likes