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

How do you make particles come out of the back of the torso?

So, I was working on a script that makes particles come out of the torso when you double jump. I've tried and tried but still doesnt seem to work out. Ho would I make particles come out of my torso when I double jump ,press space twice, instead of turning me into a ball.

local player = game:GetService("Players").LocalPlayer
mouse = player:GetMouse()
local jump = false
local charging = false
local homing = false
local speed = 30
local direction = Vector3.new(0, 0, 1)
local lastPosition = Vector3.new(0, 0, 0)
local orginPosition = Vector3.new(0, 0, 0)
local lastTarget = nil
local velocity = Instance.new("BodyVelocity")
local spin = Instance.new("Part")
spin.Name = "Spin"
spin.Anchored = true
spin.CanCollide = false
spin.BackSurface = 0
spin.BottomSurface = 0
spin.FrontSurface = 0
spin.LeftSurface = 0
spin.RightSurface = 0
spin.TopSurface = 0
spin.Shape = 0
spin.Material = "Neon"
spin.Size = Vector3.new(4, 4, 4)
local hint = Instance.new("Hint")
hint.Text = "Spin Dash: Click and release | Homing attack: Double press spacebar"

function checkSit()
	if player.Character == nil then return true end
	if player.Character:FindFirstChild("Humanoid") == nil then return true end
	if player.Character.Humanoid.Sit == true then return true end
	return false
end

function transparent(value, object)
	if object == nil then return end
	object = object:children()
	if #object < 1 then return end
	for i = 1, #object do
		if object[i].className == "Part" and object[i].Name ~= "Spin" then object[i].Transparency = value else transparent(value, object[i]) end
	end
end

function onButton1Down()
	local torso = player.Character:FindFirstChild("Torso")
	if charging == true or torso == nil or homing == true or checkSit() == true then return end
	charging = true
	speed = 50
	spin.BrickColor = torso.BrickColor
	spin.Parent = player.Character
	for i = 1, 50 do
		if charging == false then return end
		if jump == true then break end
		speed = speed + 3
		spin.CFrame = CFrame.new(Vector3.new(0, 0, 0), direction) + torso.Position - Vector3.new(0, 1.01, 0)
		spin.CFrame = spin.CFrame * CFrame.fromEulerAnglesXYZ(-1 * i, 0, 0)
		if spin.Parent == nil then spin.Parent = player.Character end
		wait()
		if i == 1 then transparent(1, player.Character) end
	end
	if jump == true then transparent(1, player.Character) end
	onButton1Up()
end

function onButton1Up()
	local torso = player.Character:FindFirstChild("Torso")
	if torso == nil or jump == true or charging == false or checkSit() == true then return end
	charging = false
	lastPosition = torso.Position
	velocity.maxForce = Vector3.new(1e+005, 0, 1e+005)
	velocity.Parent = player.Character:FindFirstChild("Torso")
	for i = 1, speed do
		if jump == true or charging == true then break end
		if checkSit() == true then break end
		speed = speed - 1
		local trail = spin:clone()
		trail.Transparency = .8
		trail.TopSurface = 0
		trail.BottomSurface = 0
		trail.CFrame = spin.CFrame
		trail.Parent = player.Character
		game:service("Debris"):addItem(trail, .15)
		spin.CFrame = CFrame.new(Vector3.new(0, 0, 0), direction) + torso.Position - Vector3.new(0, 1.01, 0)
		spin.CFrame = spin.CFrame * CFrame.fromEulerAnglesXYZ(-1 * i, 0, 0)
		if spin.Parent == nil then spin.Parent = player.Character end
		velocity.velocity = direction * speed
		lastPosition = torso.Position
		if i == 1 then transparent(1, player.Character) end
		wait()
	end
	if jump == false or charging == false then
		velocity.Parent = nil
		spin.Parent = nil
		transparent(1, player.Character)
	end
end

function onKeyDown(key)
	key = key:lower()
	local torso = player.Character:FindFirstChild("Torso")
	if (key == " ") and jump == false and torso ~= nil then
		jump = true
		spin.BrickColor = torso.BrickColor
		for i = 1, 15 do
			if homing == true or jump == false then break end
			spin.CFrame = torso.CFrame * CFrame.fromEulerAnglesXYZ(-.5 * i, 0, 0)
			if spin.Parent == nil then spin.Parent = player.Character end
			wait()
			if i == 1 then transparent(1, player.Character) end
		end
		if homing == false then spin.Parent = nil transparent(1, player.Character) end
		jump = false
	elseif (key == " ") and homing == false and torso ~= nil then
		homing = true
		jump = false
		transparent(1, player.Character)
		local target = nil
		local distance = 100
		local list = game.Workspace:children()
		for i = 1, #list do
			if list[i].className == "Part" and list[i].Size.magnitude < 6 and list[i] ~= lastTarget and (list[i].Position - torso.Position).magnitude < distance and list[i].Position.y < torso.Position.y then
				target = list[i]
				distance = (list[i].Position - torso.Position).magnitude
			end
		end
		if target ~= nil then
			lastTarget = target
			velocity.maxForce = Vector3.new(1e+005, 1e+005, 1e+005)
			velocity.Parent = torso
			transparent(1, player.Character)
			for i = 1, 50 do
				if jump == true or (torso.Position - target.Position).magnitude < 4 then break end
				spin.CFrame = torso.CFrame * CFrame.fromEulerAnglesXYZ(-1 * i, 0, 0)
				if spin.Parent == nil then spin.Parent = player.Character end
				local trail = spin:clone()
				trail.Transparency = .9
				trail.TopSurface = 0
				trail.BottomSurface = 0
				trail.CFrame = spin.CFrame
				trail.Parent = player.Character
				game:service("Debris"):addItem(trail, .5)
				velocity.velocity = (target.Position - torso.Position).unit * 200
				wait()
			end
			spin.Parent = nil
			transparent(1, player.Character)
			homing = false
			velocity.maxForce = Vector3.new(0, 1e+005, 0)
			velocity.velocity = Vector3.new(0, 50, 0)
			wait(.2)
			velocity.Parent = nil
		else
			originPosition = torso.Position
			lastTarget = nil
			velocity.maxForce = Vector3.new(1e+005, 1e+005, 1e+005)
			velocity.Parent = torso
			for i = 1, 20 do
				if (torso.Position - originPosition).magnitude > 20 or checkSit() == true then break end
				spin.CFrame = torso.CFrame * CFrame.fromEulerAnglesXYZ(-1 * i, 0, 0)
				if spin.Parent == nil then spin.Parent = player.Character end
				local trail = spin:clone()
				trail.Transparency = .9
				trail.TopSurface = 0
				trail.BottomSurface = 0
				trail.CFrame = spin.CFrame
				trail.Parent = player.Character
				game:service("Debris"):addItem(trail, 1)
				velocity.velocity = torso.CFrame.lookVector * 180
				wait()
			end
			velocity.Parent = nil
			spin.Parent = nil
			transparent(1, player.Character)
			wait(.25)
			homing = false
		end
	end
end


	if mouse == nil then return end
	if player:FindFirstChild("Message") ~= nil then player.Message.Parent = nil end
	hint.Parent = player
	mouse.Button1Down:connect(onButton1Down)
	mouse.Button1Up:connect(onButton1Up)
	mouse.KeyDown:connect(onKeyDown)
	mouse.Move:connect(function()
		if player.Character:FindFirstChild("Torso") ~= nil then
			direction = (mouse.Hit.p - player.Character:FindFirstChild("Torso").Position).unit
			direction = Vector3.new(direction.x, 0, direction.z)
		end
end)

I want particles instead of the part (Ball)

2 comments

0

can you post your current script?

0

Alright. It's updated.

1 answer

✓ Accepted answer

If you clone a particle emmiter and set its parent to the torso and in the partice emmiters options have the emmitter direction set to "back" then disabe itand enable it everytime the player double jumps.

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