I need help with item handles and animations!

I’m trying to make a tool with an animation for a guitar and it looks normal locally but for other people it is broken behind their back
Screenshot_3

local Tool = script.Parent
local Player = Tool.Parent.Parent
local Char = Player.Character
local hold = Tool.hold

Tool.Equipped:Connect(function()
	Char.RightHand:WaitForChild("RightGrip"):Destroy()
	local Motor6D = Instance.new("Motor6D",Char.UpperTorso)
	Motor6D.Name = "HandleMotor6D"
	Motor6D.Part0 = Char.UpperTorso
	Motor6D.Part1 = Tool.Handle
	Motor6D.C0 = CFrame.new (0,0.2,-0.7)
	
	local anim = Tool.hold
	hold = Char.Humanoid:LoadAnimation(anim)
	hold:Play()
end)

Tool.Unequipped:Connect(function()
	if Char.RightHand:FindFirstChild("HandleMotor6D")then
		Char.RightHand.HandleMotor6D:Destroy()
	end
	hold:Stop()
	end)
	

Are you creating this Motor on the Client or Server?

2 Likes

I’m pretty sure it’s client side.

Try making it on the server instead, and see if the problem still priests. :+1:

Can I ask you, how you would go about that?

Its quite simple, all you would need to do is setup a remote event which on the server(script) creates the motor for you, then from there you can use the Method fo the remote event called FireServer to fire the event on the client, with the Equipped event, (this concept also applies for removing the motor).

You can find more Info on remote events: here

1 Like

I sort of understand also I tried to click your hyperlink and it didn’t redirect me.

1 Like

Let me just give a quick example:

--[[Server]]--

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local RemoteEvent = Instance.new("RemoteEvent")  -- We create a remote event(You can create it in studio if you want)

RemoteEvent.Name = "MotorEvent" -- The RemoteEvent's Name
RemoteEvent.Parent = game:GetService("ReplicatedStorage")  -- You can access this RemoteEvent from here

local function MotorMethod(Player) -- We create the function
	-- You can create the motor here
end

RemoteEvent.OnServerEvent:Connect(MotorMethod) 

--[[Client]]--

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local MotorEvent = ReplicatedStorage:WaitForChild("MotorEvent")

-- From here on out you can use the :FireServer method to call the method on the server e.g MotorEvent:FireServer()
1 Like

I’m not very much a coder so I don’t really understand some of the terminology you’re putting down, is there anyway you can simplify it another to a coding noob?

I would say it would be much easier to create the motor when player joins: This is a good example:

I tried that tutorial and kept getting errors inside the output, it seems others in the reply are having the same issue…