Equip tool from StarterCharacterScripts?

Basically I made a parry system for mobile, and I tried to make it equip the tool after they finish parrying because when they parry, it unequips ur tool. All I want is a way to define the tool i’m looking for from StarterCharacterScripts

local UIS = game:GetService("UserInputService")
local Players = game:GetService("Players")

-- Folders 
-- Player
local player = game.Players.LocalPlayer
local character = player.Character
while not character or not character.Parent do
	character = player.Character
	wait()
end
local human = character:WaitForChild("Humanoid")

-- events
local rs = game:GetService("ReplicatedStorage")
local parryEvent = rs.Parry
local deparry = true
local function Parry(actionName,inputState)
		if actionName == "Parry" and inputState == Enum.UserInputState.Begin then
			if deparry == true then
				deparry = false
				local parry = human:LoadAnimation(script.Parry)
			local idle = human:LoadAnimation(script.Idle)
			print("hi")
				parry:Play()
				script.ParryStarted:Play()
				game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
				human:UnequipTools()
				human.WalkSpeed = 0
				human.JumpPower = 0
				game.ReplicatedStorage.Parry:FireServer("On")
			wait(0.6)
			if character:FindFirstChild("Bat") then
				human:EquipTool(character:FindFirstChild("Bat"))
				idle:Play()
			end
				wait(0.2)
				game.ReplicatedStorage.Parry:FireServer("Off")
				human.WalkSpeed = 16
				human.JumpPower = 50
				game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
				wait(5) 
			deparry = true
			end
		end
end

game:GetService("ContextActionService"):BindAction("Parry",Parry,true,Enum.KeyCode.Q,Enum.KeyCode.Q)

game:GetService("ContextActionService"):SetPosition("Parry",UDim2.new(0.40, 0, -0.35, -20))
game:GetService("ContextActionService"):SetTitle("Parry", "Parry")

When you unequip the tool it’ll end up in the player’s backpack.

Yeah, it doesn’t work, when I try to equip and parry (on mobile) it just unequips and ignores findfirstchild(“bat”)

The tool ends up in Player.Backpack once you unequip it. Do Player.Backpack:FindFirstChild(“Bat”)

1 Like