Grapple Hook from Toolbox not working when in StarterPack

Hi!
I’m making an obby, and a grappling hook woiuld be a nice feature.
I’ve imported the “Grappling Hook Remake” by Vyhtx21 from the toolbox.
When playtesting, it works fine, as long as I place the tool directly in the workspace and the player picks up in-game.
However, if I place it in the StarterPack, the Player can equip it, and can see the character holding it in his hand, but it doesn’t work (the hand cursor is visible, but clicking the mouse does nothing).
The same happens when I give it to the player via script when he has a gamepass (which is what I actually want):

local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ServerStorage = game:GetService("ServerStorage")
local tools = ServerStorage.Tools

print ("Equimpment Script läuft")


local gamepassTools = {
	{Name = "Pistol", ID = 685621110},
	{Name = "Machete", ID = 689389860},
	{Name = "Grappling Hook", ID = 685133952},
}

Players.PlayerAdded:Connect(function(player)
	for _, v in gamepassTools do
		local hasPass = false
		
		local success, msg = pcall(function()
			hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, v.ID)
		end)
		
		if hasPass then
			local tool1 = tools[v.Name]:Clone()
			tool1.Parent = player.Backpack
			local tool2 = tools[v.Name]:Clone()
			tool2.Parent = player.StarterGear
		else
			print("Not owned")
		end
		
		if not success then
			warn(msg)
		end
	end
	
	
	
	
	
	
end)

My code doesn’t seem to be the problem, as the other tools work fine when the player is given them this way.

Here’s the script that comes with the grappling hook:

--[[

Grappling Hook ModuleScript

Made by: Demi aka @thedemster aka LilTonyGJr aka UnnoticedDemi

Supports r6 and r15

Started: 8/12/2023

Last Update: 8/12/2023 (The comments here are from 8/13/2023)

--------------------------------

UPDATE LOG:

0. 8/12/2023: Released the grappling hook

1. 8/13/2023: Made printing all grapples a comment to be enabled by the user, added this comment section.

--------------------------------

Made using "B Ricey"'s YT grappling hook tutorial

Nice

--------------------------------

CURRENT CONTROLS:

Left Click to launch a grapple (Duh.)

Hold Left Click to reel in towards the grapple (Duh. (x2))

Let go of Left Click to detach the grapple (Duh. (x3))

Hold E while grappling to Grapple Brake, Hold E shortly after detaching a grapple to Air Lock

--------------------------------

]]

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

local Tool = script.Parent
local Barrel = Tool.Parts:WaitForChild("Barrel")
local Hook = Tool.Parts:WaitForChild("Hook")
local firePoint = Tool.Parts:WaitForChild("firePoint")
local hookRef = Tool.Parts:WaitForChild("hookRef")
local hookWeld = Tool.WeldsAndConstraints.hookWeld
local Reel = Tool.WeldsAndConstraints.Reel
local FireSound = firePoint.Fire
local ImpactSound = Hook.Impact
local AirReleaseSound = Tool.Parts.Barrel.AirRelease

local Active = Tool:WaitForChild("Active")

local ConnectionLine = Tool.ConnectionLine

local Player = nil
local HRP = nil
local Char = nil
local Mouse = nil
local curTween = nil
local curPlaying = nil

local module = {}

function toggleHumanoidGrappleState(active)
	local Humanoid = Player.Character and Player.Character:FindFirstChild("Humanoid")
	
	if Humanoid then
		if active then
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, false)
			Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
		else
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, true)
			Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		end
	end
end

local function client_init()
	Player = Players.LocalPlayer
	
	Char = Player.Character or Player.CharacterAdded:Wait()
	HRP = Char:WaitForChild("HumanoidRootPart")
	Mouse = Player:GetMouse()
	
	Player.CharacterAdded:Connect(function()
		Char = Player.Character or Player.CharacterAdded:Wait()
		HRP = Char:WaitForChild("HumanoidRootPart")
		Mouse = Player:GetMouse()
	end)
	
	Mouse.TargetFilter = Player.Character
	
	Tool.Activated:Connect(function()
		if not Active.Value and Mouse.Target then
			-- print(Player.Name .. " has grappled onto a part named: " .. Mouse.Target.Name) -- Decomment this for logging all grapples
			toggleHumanoidGrappleState(true)
			ConnectionLine:FireServer(true, Mouse.Hit.p)
		end
	end)
	
	Tool.Equipped:Connect(function()
		Char = Player.Character or Player.CharacterAdded:Wait()
		HRP = Char:WaitForChild("HumanoidRootPart")
		Mouse = Player:GetMouse()
	end)
	
	Tool.Deactivated:Connect(function()
		ConnectionLine:FireServer(false)
		toggleHumanoidGrappleState(false)
	end)
	
	Tool.Unequipped:Connect(function()
		ConnectionLine:FireServer(false)
		toggleHumanoidGrappleState(false)
	end)
	
	UIS.InputBegan:Connect(function(Key, Chatting)
		if not Chatting and Active.Value then
			if Key.KeyCode == Enum.KeyCode.E then -- Stand Still in the air
				AirReleaseSound:Play()
				while wait(0.1) and UIS:IsKeyDown(Enum.KeyCode.E) do
					HRP.CFrame = CFrame.lookAt(HRP.Position, Hook.Position)
					Barrel.Anchored = true
				end
				AirReleaseSound:Stop()
				Barrel.Anchored = false
			end
		end
	end)
end

local function server_init()
	ConnectionLine.OnServerEvent:Connect(function(plr, targetState, mousePos)
		Active.Value = targetState
		
		if Active.Value then
			FireSound:Play()
			Fire(mousePos)
		else
			Reset()
		end
	end)
end

local function _init()
	if RunService:IsClient() then
		client_init()
	elseif RunService:IsServer() then
		server_init()
	end
end

function Fire(mousePos)
	
	local initialPos = hookRef.Position
	
	local dist = (mousePos - initialPos).Magnitude
	
	hookWeld.Enabled = false
	Hook.Anchored = true
	
	wait()
	
	ImpactSound:Play()
	Hook.Position = mousePos
	Reel.FreeLength = dist
	
	local reelInfo = TweenInfo.new(
		dist/100,
		Enum.EasingStyle.Linear
	)
	
	curPlaying = firePoint["Reel" .. math.random(1,4)]
	curPlaying:Play()
	
	local reelTween = TweenService:Create(Reel, reelInfo, {FreeLength = 1})
	
	reelTween:Play()
	
	curTween = reelTween
end

function Reset()
	if curPlaying then
		curPlaying:Stop()
	end
	if curTween then
		curTween:Cancel()
	end
	
	Hook.CFrame = hookRef.CFrame
	hookWeld.Enabled = true
	Hook.Anchored = false
	
	Reel.FreeLength = 1
end

_init()

return module

I’ve teached myself some scripting by now, but I would appreciate some help from more experienced scripters to understand what’s going wrong here.

Thanks a lot!

1 Like