Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Explosion not spawning in the correct position?

I've made a script where if the player touches the ground an explosion spawns in his head and he dies. But for some reason it spawns at 0,0,0 not the head position.

local part = script.Parent

part.Touched:connect(function(hit)
	local countdown = game.ReplicatedStorage:WaitForChild('Countdown')
	
	local character = hit.Parent
	local humanoid = hit.Parent:FindFirstChild('Humanoid')
	
	if humanoid and character and countdown.Value > 1 then
		Instance.new('Explosion', character.Head)
		humanoid.Health = 0
	end
end)

1 answer

✓ Accepted answer

You have to set the explosion's Position property. Just parenting the explosion to the character's head will not affect the position.

Instance.new('Explosion', character.Head).Position = character.Head.Position

1 comment

0

Thanks alot! I tried something like that but set the position a line after as a new statement but it ended up not spawning.

This discussion is preserved as it was. New answers, comments, and votes are closed.