I am trying to make it so that if a part is not a model in the list, it’ll smash the motorcycle. Can anyone help?
local uncrashable = {workspace.loop, workspace.Baseplate}
local exploded = false
function onTouched(part)
if exploded == false then
exploded = true
local h = part
print(h.Name)
if script.Parent.Parent.EngineBlock.Velocity.Magnitude >= 60 then
if part.Parent ~= uncrashable or part ~= uncrashable then
--local boom = Instance.new("Part")
--boom.CanCollide = false
--boom.Locked = true
--boom.Anchored = true
--boom.Transparency = 1
script.Parent.ParticleEmitter:Emit(30 * script.Parent.Parent.EngineBlock.Velocity.Magnitude)
local pow = Instance.new("Explosion")
pow.ExplosionType = Enum.ExplosionType.NoCraters
pow.Position = script.Parent.Position
pow.BlastRadius = 10
pow.Parent = script.Parent
pow.Visible = false
local bam = workspace.Boom:Clone()
bam.Parent = script.Parent
bam:Play()
local bom = workspace.Pow:Clone()
bom.Parent = script.Parent
bom:Play()
end
end
end
end
script.Parent.Touched:Connect(onTouched)
--script.Parent.Touched:connect(onTouched)