I am making it so if a cart in a cart ride runs into you, you explode. I have this function which does it, and a touched function that fires it. Here is my full code which has both below:
function explode(t)
local hum = t.Parent:FindFirstChildOfClass("Humanoid")
local bigboom = Instance.new("Explosion")
bigboom.Position = t.Parent.HumanoidRootPart.Position
bigboom.TimeScale = 0
bigboom.BlastPressure = 0
bigboom.BlastRadius = 0
bigboom.DestroyJointRadiusPercent = 0
hum.Health = 0
end
script.Parent.Touched:Connect(function(t)
if t.Parent:FindFirstChildOfClass("Humanoid") then
local humanoid = t.Parent:FindFirstChildOfClass("Humanoid")
if script.Parent.Parent.Engine.AssemblyLinearVelocity.Magnitude > 4 then
explode(t)
end
end
end)
Only thing that actually happens is the player is killed, but you cannot see an explosion. What went wrong?