pretty self explanatory, and its quite insane that after HOURS of scouring devforum and google i couldnt find a solution.
yes i changed the rigtype in humanoid to r15. (granted it made the head mesh look weird so i just renamed the head)
i am not using a normal two legged model. its a four legged character. i want the player to be able to pick up objects with their mouths. i dont want to use the same “this object is permanently welded to the player and transparent until otherwise needed” trick that i use with accessories because that seems like a MASSIVE pain. long term i want to be able to animate interesting things while objects are equipped.
but right now i need to actually… equip… objects…
What kind of functionality do you want from the tools? Do you want to be able to use any kind of tool (E.g. random tool from toolbox), or do you want to create your own specialized tools?
I’m not sure. I was considering having weapons (equipable with own attack animations and can be holstered) and prey/herbs (that can be hunted and stored, very much like Warrior Cats: Ultimate Edition does). Obviously those are gonna be hard to implement but right now my goal is to have the objects actually be equipped lol. I really like how WCUE uses Proximity Prompts for most of the objects they pick up, rather than the normal backpack (the downside being they can only hold one object at a time, and I want the players to have an inventory), but I can’t figure out how to implement that. Also right now I’m using toolbox tools as placeholders since I haven’t made my own meshes yet.
im pretty sure with custom characters, if the tool has a handle, and there’s no arm part, or anything related to that you can’t equip it. I recommend welding the tool to the character, and animating it.
I have made the following script below. To use it you will have to paste the code into a serverscript under the tool, and also create the following:
Attachment named ‘PlayerAttachment’ under the tool’s handle.
Attachment named ‘ToolAttachment’ under the players HumanoidRootPart
local tool = script.Parent
local handle = tool.Handle
tool.RequiresHandle = false
local function GetRigidConstraint(rootPart)
local name = "PlayerRigidConstraint"
local constraint = tool:FindFirstChild(name)
if constraint then return constraint else
constraint = Instance.new("RigidConstraint")
constraint.Name = name
constraint.Enabled = false
constraint.Attachment0 = handle:FindFirstChild("PlayerAttachment")
constraint.Attachment1 = rootPart:FindFirstChild("ToolAttachment")
constraint.Parent = tool
end
return constraint
end
local function WeldTool(player)
local rootPart = player.Character:FindFirstChild("HumanoidRootPart")
local toolAttachment = (function()
local attachment = rootPart:FindFirstChild("ToolAttachment")
if attachment then return attachment
else
error(tostring(player).. " does'nt have ToolAttachment in HumanoidRootPart")
end
end)()
GetRigidConstraint(rootPart).Enabled = true
local ancestryConnection
ancestryConnection = tool.AncestryChanged:Connect(function(_, parent)
if parent ~= player then
GetRigidConstraint(rootPart).Enabled = false
handle.Anchored = true
handle.CFrame += toolAttachment.WorldCFrame.LookVector * 5
handle.Anchored = false
ancestryConnection:Disconnect()
end
end)
end
local touchConnection
local function touch(hit)
local hitPlayer = game.Players:GetPlayerFromCharacter(hit.Parent)
local toolPlayer = game.Players:GetPlayerFromCharacter(tool.Parent)
if hitPlayer and not toolPlayer then
tool.Parent = hit.Parent
touchConnection:Disconnect()
end
end
touchConnection = tool.Handle.Touched:Connect(touch)
tool.AncestryChanged:Connect(function(_, parent)
local player = game.Players:GetPlayerFromCharacter(parent)
if player then
WeldTool(player)
elseif not player and parent ~= nil then
touchConnection = tool.Handle.Touched:Connect(touch)
else
touchConnection:Disconnect()
end
end)
This is a custom method of equipping tools, which does not need the right arm in order to pickup/use tools.
To adjust the position and orientation of the tool when equipped, you will need to adjust either the position/orientation of the handle’s attachment or rootpart’s attachment.
It doesn’t do any damage properly, which is fine for now since I’m nowhere near ready to script any sort of combat system. I love it, thanks so much! You’ve saved me a lot of work haha
Im happy to hear it worked. About the damage not working, i believe it might have something to do with that sword specifically and how it works, because i tested this:
local tool = script.Parent
local handle = tool:WaitForChild("Handle")
handle.Touched:Connect(function(hitPart)
print(hitPart)
end)