What is the best way to make a tool stay onto player's back

I need a tool for my game that stays on players backs while in their inventory and not in use. Currently, I am using a baguette as a model. I have created it to spin because my game will be very silly. But due to me not being great at scripting with models, the models disappear when one player holds it. And I have not been able to fix this issue. I assume it is because the script gets all the baguettes, but I still haven’t found a simple fix.
Here is a GIF of what I am talking about.
https://gyazo.com/f72ddd0a914f2b8559c5eaad1221608d

I have tried multiple things. I could not weld when unequipped due to my tool needing to be on a hinge.

This is my script so far.

wait(2)
local p = script.Parent
local bag = game.ReplicatedStorage.bag:Clone()
bag.Parent = p
wait(.2)
script.Parent.bag.Attachment1.Parent = p.Torso
script.Parent.bag.NoCollisionConstaint.Part0 = p.bag
local block = game.ReplicatedStorage.blocker:Clone()
block.Parent = p
script.Parent.blocker.Position = p.Torso.Position
script.Parent.blocker.WeldConstraint.Part0 = p.blocker
script.Parent.blocker.WeldConstraint.Part1 = p.Torso
script.Parent.bag.NoCollisionConstaint.Part1 = p.blocker

game.ReplicatedStorage.grip.OnServerEvent:Connect(function(player)
	script.Parent.bag.Transparency = 1
	end)
game.ReplicatedStorage.gripoff.OnServerEvent:Connect(function(player)
	script.Parent.bag.Transparency = 0
	end)

in the tool



local holdanimationid = 6764886151 
local swinganimationid = 6764901384 


repeat wait() until game.Players.LocalPlayer.Character
local lp = game.Players.LocalPlayer
local sp = script.Parent
local debounce = true

local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://" .. holdanimationid
local holdtrack = lp.Character.Humanoid:LoadAnimation(anim)

local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://" .. swinganimationid
local swingtrack = lp.Character.Humanoid:LoadAnimation(anim)

sp.Equipped:connect(function()
	game.ReplicatedStorage.grip:FireServer()

	holdtrack:Play()
end)

sp.Unequipped:connect(function()
	holdtrack:Stop()
	game.ReplicatedStorage.gripoff:FireServer()
end)

sp.Activated:connect(function()
	
	if debounce == true then
		debounce = false
		swingtrack:Play()
		wait(swingtrack.Length)
		debounce = true
	end
end)

I needed a simular thing for my game

This video does a great job of walking through it

2 Likes

I cannot weld it because it needs to be hinged onto the torso.

DONT USE WELDS!!! Welds can sometimes break as well as can cause confusion. Make the item a “accessory” then clone it into the player or use Humanoid:AddAccessory() as well as in the accessory of the model clone the attachment from the R15 characters UpperTorso called “BodyBackAttachment” then copy then paste into the item you want for the back. Here is a video on back accessories. VIDEO . Hope this helps! :wink:

1 Like

As I said, I need to create a hinge to connect them so it spins. If I create it as an accessory, I cannot create a hinge due to it already being attached.

Hinges may not be the best way to make it spin because roblox physics from server-client sucks.

but what you could do is create a part that’s welded on to the player. then create a hinge joint that connects to the Tool?

im not sure how good hinge joints are at holding things together so it may not be great.

I did do that. As you can see in the script I provided, it shows that it hinges to a block named “blocker” so it does not glitch the player.

Very simple fix. Make a remote parented to the local script so every player gets their own remote. What you were doing was calling the same remote and it all linked to everyones local script. Or you can add and extra argument that shows which player did it and make an if statement to see if the local player called the remote.

1 Like