Tool won't work with Custom Character

I have a tool in my game and it works fine for a r15 character.

But when I change it to a Custom Character by putting a StarterCharacter into StarterPlayer the tool just doesn’t work.

First of all the tool doesn’t go to the right position, it spawns on the ground but it does not go to the character.

The tool script doesn’t function at all. Everything I coded doesn’t run, however when I am not a custom character then it functions fine. How do u fix this?

Thanks for helping!

2 Likes

Have you tried making it weld to the custom characters arm? Does it also have a handle?

1 Like

It has a handle, I’ll try welding it. Does the weld have to be inside the handle?

It has to be in the handle and welded to whatever the hand is called for holding it. You could also make the weld through your script with Instance.new to create a new instance

2 Likes

Well, it’s now connected to the hand… But the scripts don’t work

And it’s also weirdly rotated, it wasn’t before!, Oh, that just has to do with the rotation of the hand

The front surface has to face the proper way, instead of using the weld you can search in the toolbox for Weld and get Quentys qperfectionweld.

Can you show me the script so I can try to better help you?

It has to do with

tool.Activated:Connect(function()

It won’t run, but it did with a normal Roblox character

And as I said, there are no errors inside the output

( I tested it by using prints and it didn’t print out anything with the custom character)

Have you tried print checks to see where the print stops?

1 Like

It doesn’t run the function

Here is the full script if u want to check it out:

local RunService = game:GetService("RunService")
print("hi")
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")

local tool = script.Parent
local base = tool:WaitForChild("Base")
local hook = tool:WaitForChild("Hook")
local HookWeld = hook.MyHookWeld
local spring = base.Spring
local hookReference = tool:WaitForChild("HookReference")
local MessageEvent = script:WaitForChild("MessageEvent")
local activated = script:WaitForChild("Activated")
local beam = base:WaitForChild("Beam")
local weld2 = tool:WaitForChild("Handle"):WaitForChild("Handle")

local DragMode = true
local BodyVelocityMode = false

--ONLY CLIENt

local player = nil
local mouse = nil
local currentTween = nil

local GrappleGun = {}

local Hittable = {
	"Grapple"
}

local 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)
			beam.Enabled = true
		else
			humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, true)
			humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
			beam.Enabled = false
		end
	end
end

local function clientInit()
	player = Players.LocalPlayer
	mouse = player:GetMouse()
	
	weld2.Part1 = player.Character.RightHand
	tool.Handle.Anchored = false
	
	mouse.TargetFilter = player.Character
	
	tool.Activated:Connect(function()
		print("E")
		if not GrappleGun.IsActivated() and mouse.Target and table.find(Hittable, mouse.Target.Name) then
			MessageEvent:FireServer(true, mouse.Hit.Position)
			ToggleHumanoidGrappleState(true)
		end
	end)
	
	tool.Deactivated:Connect(function()
		MessageEvent:FireServer(false)
		ToggleHumanoidGrappleState(false)
	end)
	tool.Unequipped:Connect(function()
		MessageEvent:FireServer(false)
		ToggleHumanoidGrappleState(false)
	end)
end



local function serverInit()
	MessageEvent.OnServerEvent:Connect(function(player, _activated, targetPosition)
		activated.Value = _activated
		
		if GrappleGun.IsActivated() then
			GrappleGun.Fire(targetPosition)
		else
			GrappleGun.Reset()
		end
		
	end)
end



local function init()
	if RunService:IsClient() then
		clientInit()
	elseif RunService:IsServer() then
		serverInit()
	end
end

function GrappleGun.IsActivated()
	return activated.Value
end

function GrappleGun.Fire(targetPosition)
	local initialPos = hookReference.Position	
	
	local distance = (targetPosition - initialPos).Magnitude
	
	HookWeld.Enabled = false
	hook.Anchored = true
	
	wait()
	
	hook.Position = targetPosition
	spring.FreeLength = distance
	
	if DragMode == true then
		local info = TweenInfo.new(distance/60, Enum.EasingStyle.Linear)
		local tween = TweenService:Create(spring, info, {FreeLength = 1})
		
		tween:Play()
		currentTween = tween
	end
end

function GrappleGun.Reset()
	if currentTween then
		currentTween:Cancel()
	end
	
	hook.CFrame = hookReference.CFrame
	HookWeld.Enabled = true
	hook.Anchored = false
	spring.FreeLength = 1
end


init()
return GrappleGun

Okay so I found a post that may help
https://devforum.roblox.com/t/solved-do-the-tools-not-work-for-custom-characters/561690&ved=2ahUKEwjuqoDgwvPvAhWaLc0KHVqzAcYQFjAAegQIAxAC&usg=AOvVaw0lw4C6XjkX2iHCM4AknA7w

It doesn’t work for me, it says I can’t open it because it’s private or it doesn’t exist anymore.

My fault I posted the wrong link Do the tools not work for custom characters?

2 Likes

That might work fine, thanks for helping me! I’ll try it straight away.

No problem, I hope it works, if you need anymore help let me know

1 Like