I am not sure where to start so asking for some help. I want to create a script that detects if the part is hit by a person.
Can anyone give an idea?
local Debris = game:GetService("Debris")
local wall = script.Parent
script.Parent.Touched:Connect(function(hit)
if hit.Name ~= "Rails" then
if hit.Name ~= "Baseplate" then
if hit.Name ~= "Essential" then
local explode = Instance.new("Explosion")
explode.Parent = hit
explode.Position = hit.Position
hit:BreakJoints()
Debris:AddItem(hit, 5)
end
end
end
end)
Thanks