Bomb spawns at a weird location

I want to make a time bomb spawn inside my game but for some reason it spawns at a weird location, i’ve made the normal bomb and it works just fine. it spawns in front of the player.
Here’s a video of the bug:


tool.Activated:Connect(function()
	if not projectilemode then
		if not R then
			if not db then
				timeractive = true
				db = true
				local bomb = script.Parent.Handle:Clone()
				A.BombFuse.Looped = true
				A.BombFuse:Play()
				bomb.Anchored = false
				bomb.Parent = workspace
				bomb.CanCollide = true
				if timeractive then
					repeat
						wait(1)
						timer -= 1
					until timer == 0 or not timeractive
				end
				if timer == 0 then
					
					A.BombFuse:Stop()
					createExplosion(bomb)
					A.ExplosionSFX:Play()
					
					bomb:Destroy()
					wait(.1)
					timer = 2
				end
				wait(1)
				db = false
			end
		else
			if not db then
				print("test")
				db = true
				local bomb = Handle2:Clone()
				bomb.Anchored = false
				bomb.Parent = workspace
				bomb.CanCollide = true
				task.wait(1)
				db = false
			end
		end
	else
                 --ignore these
		if not R then
				script.Parent.Handle.Transparency = 1
				caster.LengthChanged:Connect(onLengthChanged)
				caster.RayHit:Connect(onRayHit)
				fireRE.OnServerEvent:Connect(function(player,mousepos)
				fire(player,mousepos)
			end)
		else
			print("TimeBomb G")
		end
	end
end)

Will greatly appreciate any help!

1 Like

Well I mean showing your code would be a good start.

2 Likes

oh sorry i forgot to add it

char limit

what does the createExplosion(bomb) function explicitly do?

it doesn’t seem like you have set the bomb’s position. Maybe that’s the issue.

Try this code.

tool.Activated:Connect(function()
	if not projectilemode then
		if not R then
			if not db then
				timeractive = true
				db = true
				local bomb = script.Parent.Handle:Clone()
				A.BombFuse.Looped = true
				A.BombFuse:Play()
				bomb.Anchored = false
				bomb.Parent = workspace
				bomb.CanCollide = true
				bomb.CFrame = script.Parent.Handle.CFrame
				if timeractive then
					repeat
						wait(1)
						timer -= 1
					until timer == 0 or not timeractive
				end
				if timer == 0 then

					A.BombFuse:Stop()
					createExplosion(bomb)
					A.ExplosionSFX:Play()

					bomb:Destroy()
					wait(.1)
					timer = 2
				end
				wait(1)
				db = false
			end
		else
			if not db then
				print("test")
				db = true
				local bomb = Handle2:Clone()
				bomb.Anchored = false
				bomb.Parent = workspace
				bomb.CanCollide = true
				bomb.CFrame = Handle2.CFrame
				task.wait(1)
				db = false
			end
		end
	else
		--ignore these
		if not R then
			script.Parent.Handle.Transparency = 1
			caster.LengthChanged:Connect(onLengthChanged)
			caster.RayHit:Connect(onRayHit)
			fireRE.OnServerEvent:Connect(function(player,mousepos)
				fire(player,mousepos)
			end)
		else
			print("TimeBomb G")
		end
	end
end)