What can I fix about this script about 2 binded tools?

local TM = require(game.Players.LocalPlayer.Backpack:WaitForChild("ToolManagment"))
local UIS = game:GetService("UserInputService")


Kick = false
Equipped = false
Tool = script.Parent
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()


script.Parent.Equipped:connect(function(m)
	Equipped = true
end)

script.Parent.Unequipped:connect(function(m)
	Equipped = false
end)


local Character = Player.Character or Player.CharacterAdded:Wait()


local DisallowUse = true
local Using = false

local Character = Player.Character

if not Character or not Character.Parent then
	Character = Player.CharacterAdded:Wait()
end

local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")

local OrientationX = math.rad(HumanoidRootPart.Orientation.X)

local OrientationZ = math.rad(HumanoidRootPart.Orientation.Z)

local CanRotate = false

HumanoidRootPartRotation = coroutine.wrap(function()
	game:GetService("RunService").RenderStepped:Connect(function()
		if Player.Character and CanRotate == true then
			local rootPart = Player.Character:WaitForChild("HumanoidRootPart")
			if rootPart then
				rootPart.CFrame = CFrame.new(rootPart.CFrame.p, rootPart.CFrame.p + Vector3.new(workspace.CurrentCamera.CFrame.LookVector.X,0,workspace.CurrentCamera.CFrame.LookVector.Z))
			end
		end

	end)
end)

HumanoidRootPartRotation()
local anims = game:GetService("ReplicatedStorage").Animations
local animfolder = anims.GK

local Anim = animfolder.Save.Save

local Anim2 = animfolder.Save.Save_R

local Anim3 = animfolder.Save.Save_L

local Anim4 = animfolder.Save.HighSave

local Anim5 = animfolder.Save.HighSave_R

local Anim6 = animfolder.Save.HighSave_L

local Save = Player.Character.Humanoid:LoadAnimation(Anim)

local SaveR = Player.Character.Humanoid:LoadAnimation(Anim2)

local SaveL = Player.Character.Humanoid:LoadAnimation(Anim3)

local HighSave = Player.Character.Humanoid:LoadAnimation(Anim4)

local HighSaveR = Player.Character.Humanoid:LoadAnimation(Anim5)

local HighSaveL = Player.Character.Humanoid:LoadAnimation(Anim6)

local Anim = animfolder.Dives.MidDive
local HAnim = animfolder.Dives.HighDive
local LAnim = animfolder.Dives.MidDive_L
local LHAnim = animfolder.Dives.HighDive_L
local JAnim = animfolder.Save.HighSave
local SAnim = animfolder.Save.Save

local Save = Character.Humanoid:LoadAnimation(SAnim)

local Jump = Character.Humanoid:LoadAnimation(JAnim)

local MidDive = Character.Humanoid:LoadAnimation(Anim)

local HighDive = Character.Humanoid:LoadAnimation(HAnim)

local LeftMidDive = Character.Humanoid:LoadAnimation(LAnim)

local LeftHighDive = Character.Humanoid:LoadAnimation(LHAnim)

Mouse.KeyDown:connect(function(key)
	if Equipped == false then return end
	if TM.GetUsing() then return end
	if key ~= "e" then return end
	TM.SetUsing(true)

	Player.Character.Torso.RotVelocity = Vector3.new()
	Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
	if Player.Backpack.Settings.GKDiveType.Value == "Auto" or Player.Backpack.Settings.GKDiveType.Value == "Old" then
		Player.Character.Humanoid.WalkSpeed = 0
	else
		Player.Character.Humanoid.WalkSpeed = 37.5
	end

	CanRotate = true

	workspace.CurrentCamera.CameraSubject = Character.Head

	wait()
	if UIS:IsKeyDown(Enum.KeyCode.D) and not UIS:IsKeyDown(Enum.KeyCode.W) and not UIS:IsKeyDown(Enum.KeyCode.A) and not UIS:IsKeyDown(Enum.KeyCode.S) then
		if Player.Backpack.Settings.GKDiveType.Value == "Auto" or Player.Backpack.Settings.GKDiveType.Value == "Old" then
			local BV = Instance.new("BodyVelocity")
			BV.Parent = Player.Character["HumanoidRootPart"]
			if Player.Backpack.Module_Management.Airbourne_Tweak.Airbourne.Value == false then
				BV.Velocity = Player.Character["HumanoidRootPart"].CFrame.rightVector * 30 + Player.Character["HumanoidRootPart"].CFrame.upVector * 3.5
			else
				BV.Velocity = Player.Character["HumanoidRootPart"].CFrame.rightVector * 30 + Player.Character["HumanoidRootPart"].CFrame.upVector * 2.25
			end
			BV.MaxForce = Vector3.new(math.huge, 9999, math.huge)

			game.Debris:AddItem(BV, 0.725)
		else
			local BV = Instance.new("BodyVelocity")
			BV.Parent = Player.Character["HumanoidRootPart"]
			BV.Velocity = Vector3.new(0,3,0)
			BV.MaxForce = Vector3.new(0, 9999,0)

			game.Debris:AddItem(BV, 0.725)
			Player.Character.Humanoid.WalkSpeed = 37.5
		end
	else
		if UIS:IsKeyDown(Enum.KeyCode.A) and not UIS:IsKeyDown(Enum.KeyCode.W) and not UIS:IsKeyDown(Enum.KeyCode.D) and not UIS:IsKeyDown(Enum.KeyCode.S) then
			if Player.Backpack.Settings.GKDiveType.Value == "Auto" or Player.Backpack.Settings.GKDiveType.Value == "Old" then
				local BV = Instance.new("BodyVelocity")
				BV.Parent = Player.Character["HumanoidRootPart"]
				if Player.Backpack.Module_Management.Airbourne_Tweak.Airbourne.Value == false then
					BV.Velocity = Player.Character["HumanoidRootPart"].CFrame.rightVector * -30 + Player.Character["HumanoidRootPart"].CFrame.upVector * 3.5
				else
					BV.Velocity = Player.Character["HumanoidRootPart"].CFrame.rightVector * -30 + Player.Character["HumanoidRootPart"].CFrame.upVector * 2.25
				end
				BV.MaxForce = Vector3.new(math.huge, 9999, math.huge)

				game.Debris:AddItem(BV, 0.725)
			else
				local BV = Instance.new("BodyVelocity")
				BV.Parent = Player.Character["HumanoidRootPart"]
				BV.Velocity = Vector3.new(0,3,0)
				BV.MaxForce = Vector3.new(0, 9999,0)

				game.Debris:AddItem(BV, 0.725)
				Player.Character.Humanoid.WalkSpeed = 37.5

			end

			wait()

			local BV = Instance.new("BodyVelocity", Player.Character.HumanoidRootPart)
			BV.Velocity = Vector3.new(0, 3, 0)
			BV.MaxForce = Vector3.new(0, 7500, 0)

			game.Debris:AddItem(BV, 0.58)
		end	
	end	

	Player.Character.Torso.CollisionGroupId = 2
	Player.Character.Head.CollisionGroupId = 2
	Player.Character["Right Leg"].CollisionGroupId = 2
	Player.Character["Left Leg"].CollisionGroupId = 2
	Player.Character["Left Arm"].CollisionGroupId = 2
	Player.Character["Right Arm"].CollisionGroupId = 2
	--if Player.Backpack.Module_Management.Airbourne_Tweak.Airbourne.Value == false then
	--	Anim1:Play()
	--	Character.HumanoidRootPart.CFrame = Character.HumanoidRootPart.CFrame + Vector3.new(0, 3, 0)
	--	else
	--		Anim2:Play()
	---	end

	if Player.Backpack.Module_Management.Airbourne_Tweak.Airbourne.Value == false then
		if UIS:IsKeyDown(Enum.KeyCode.D) and not UIS:IsKeyDown(Enum.KeyCode.A) and not UIS:IsKeyDown(Enum.KeyCode.W) and not UIS:IsKeyDown(Enum.KeyCode.S) then
			MidDive:Play()
			Character.HumanoidRootPart.CFrame = Character.HumanoidRootPart.CFrame + Vector3.new(0, 2.2, 0)
		elseif UIS:IsKeyDown(Enum.KeyCode.A) and not UIS:IsKeyDown(Enum.KeyCode.W) and not UIS:IsKeyDown(Enum.KeyCode.D) and not UIS:IsKeyDown(Enum.KeyCode.S) then
			LeftMidDive:Play()
			Character.HumanoidRootPart.CFrame = Character.HumanoidRootPart.CFrame + Vector3.new(0, 2.2, 0)--	elseif not UIS:IsKeyDown(Enum.KeyCode.A) and not UIS:IsKeyDown(Enum.KeyCode.W) and not UIS:IsKeyDown(Enum.KeyCode.D) and not UIS:IsKeyDown(Enum.KeyCode.S) then
			--Jump:Play()
			--	Character.HumanoidRootPart.CFrame = Character.HumanoidRootPart.CFrame + Vector3.new(0, 2.2, 0)
		end
	else
		if UIS:IsKeyDown(Enum.KeyCode.D) and not UIS:IsKeyDown(Enum.KeyCode.A) and not UIS:IsKeyDown(Enum.KeyCode.W) and not UIS:IsKeyDown(Enum.KeyCode.S) then
			HighDive:Play()
		elseif UIS:IsKeyDown(Enum.KeyCode.A) and not UIS:IsKeyDown(Enum.KeyCode.W) and not UIS:IsKeyDown(Enum.KeyCode.D) and not UIS:IsKeyDown(Enum.KeyCode.S) then
			LeftHighDive:Play()
			--elseif not UIS:IsKeyDown(Enum.KeyCode.A) and not UIS:IsKeyDown(Enum.KeyCode.W) and not UIS:IsKeyDown(Enum.KeyCode.D) and not UIS:IsKeyDown(Enum.KeyCode.S) then
			--	Jump:Play()
		end
	end	


	Kick = true
	wait(0.75)
	CanRotate = false
	TM.Ragdoll()
	wait(0.15)
	Kick = false
	Player.Character.Torso.CollisionGroupId = 0
	Player.Character.Head.CollisionGroupId = 0
	Player.Character["Right Leg"].CollisionGroupId = 0
	Player.Character["Left Leg"].CollisionGroupId = 0
	Player.Character["Left Arm"].CollisionGroupId = 0
	Player.Character["Right Arm"].CollisionGroupId = 0
	wait(0.5)
	TM:GKGetUp()
end)

Player.Character["Right Leg"].Touched:connect(function(hit)
	if hit:FindFirstChild("IsBall") == nil then return end
	if Kick == false then return end
	Kick = false
	TM.ApplyGKForce(hit)
end)

Player.Character["Left Leg"].Touched:connect(function(hit)
	if hit:FindFirstChild("IsBall") == nil then return end
	if Kick == false then return end
	Kick = false
	TM.ApplyGKForce(hit)
end)

Player.Character["Torso"].Touched:connect(function(hit)
	if hit:FindFirstChild("IsBall") == nil then return end
	if Kick == false then return end
	Kick = false
	TM.ApplyGKForce(hit)
end)

Player.Character["Head"].Touched:connect(function(hit)
	if hit:FindFirstChild("IsBall") == nil then return end
	if Kick == false then return end
	Kick = false
	TM.ApplyGKForce(hit)
end)

Player.Character["Right Arm"].Touched:connect(function(hit)
	if hit:FindFirstChild("IsBall") == nil then return end
	if Kick == false then return end
	Kick = false
	TM.ApplyGKForce(hit)
end)

Player.Character["Left Arm"].Touched:connect(function(hit)
	if hit:FindFirstChild("IsBall") == nil then return end
	if Kick == false then return end
	Kick = false
	TM.ApplyGKForce(hit)
end)

function ChangeOwner(ball)
	game.ReplicatedStorage.ChangeOwner:FireServer(ball)
end

The thing is, the current binding is the key ā€œEā€, the tool diving should be activated by
E+D (dives right) E+A (dives left) but if you press E with any key or just press E then the lines

	Kick = true
	wait(0.75)
	CanRotate = false
	TM.Ragdoll()
	wait(0.15)
	Kick = false
	Player.Character.Torso.CollisionGroupId = 0
	Player.Character.Head.CollisionGroupId = 0
	Player.Character["Right Leg"].CollisionGroupId = 0
	Player.Character["Left Leg"].CollisionGroupId = 0
	Player.Character["Left Arm"].CollisionGroupId = 0
	Player.Character["Right Arm"].CollisionGroupId = 0
	wait(0.5)
	TM:GKGetUp()

get activated. What can I fix?

2 Likes