I need to know how to make the character jump when using tool. I am using a tool where you throw a knife and it teleports you to the knife.But it keeps aiming down and the knife goes out of the map making me die so I want it so I press the tool so the character jumps and throws the knife out at the same time.

bin = script.Parent
me = script.Parent.Parent.Parent

enabled = true

function onButton1Down(mouse)
if not enabled then
		return
end

	local player = game.Players.LocalPlayer
	if player == nil then return end

      enabled = false
	RightShoulder = me.Character.RightUpperArm.RightShoulder
		Run = game:GetService("RunService")
			for i = 1, 12 do
				RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.16)
				RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, -0, 0)
				Run.Stepped:wait(0.005)
			end
		game:GetService("Chat"):Chat(me.Character.Head, "Flying Raijin Lvl 2!!")
		x = script.Kunai:clone()
		x.Name = me.Character.Name
		x.CFrame = x.CFrame * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))
		y = Instance.new("BodyVelocity")
		y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
		y.velocity = me.Character.UpperTorso.CFrame.lookVector*100
		x.Parent = me.Character.UpperTorso
		y.Parent = x
		p = Instance.new("StringValue", x)
		p.Value = me.Character.Name
		p.Name = "Owner"
      
		x.CFrame = me.Character.UpperTorso.CFrame*CFrame.new(0, 0, 0)
		z = Instance.new("Part")
		z.Parent = me.Character.UpperTorso
		z.CFrame = CFrame.new(x.Position)
		z.Anchored = true
		z.Transparency = 1
		z.CanCollide = false
		wait(0.25)
		for i = 1, 12 do
			RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0)
			RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.16)
			Run.Stepped:wait(0.01)
		end
		wait(2)
		if x.TP.Value == 1 then
		zz = script.ParticleEmitter:clone()
		zz.Parent = me.Character.UpperTorso
		game.Debris:AddItem(zz,2)
		me.Character.UpperTorso.CFrame = CFrame.new(x.Position)
		game.Debris:AddItem(x, 2)
		else
		print('do not teleport')
		game.Debris:AddItem(x, 2)
        end

      wait(1)
      
enabled = true
	end

      

enabled = true
function onS(mouse) 
mouse.Button1Down:connect(function() onButton1Down(mouse) end) 
end 
bin.Selected:connect(onS)

1 comment

0

There is a jump property in humanoid, if you set it to true the player will jump