I’m trying to make a player carry a box and when they equip the tool the animation plays fine on the client but not for anyone else on the server.
This is what I have,
local Player = script:FindFirstAncestorWhichIsA("Player")
script.Parent.Equipped:Connect(function()
Anim = Player.Character.Humanoid:LoadAnimation(script.Animation)
local Motor = Instance.new("Motor6D",Player.Character.Torso)
Motor.Part0 = Player.Character.Torso
Motor.Part1 = script.Parent.fakebox
Motor.Name = "fakebox"
Anim:Play()
Player.Character.Humanoid.WalkSpeed = 11
Player.Character.Humanoid.JumpPower = 0
end)
script.Parent.Unequipped:Connect(function()
if Player.Character.Torso:FindFirstChild("fakebox") then
Player.Character.Torso.fakebox:Destroy()
end
Anim:Stop()
Player.Character.Humanoid.WalkSpeed = 16
Player.Character.Humanoid.JumpPower = 50
end)
What my problem is, is that for other players the arms work fine on the animation just the box is not in its correct place. Example being:
Also the video is being dumb so just download it, its a mp4 file so I don’t know the issue.
I haven’t figured out what the issue could be, any solutions?
I FOUND A FIX, more of a bandaid fix. (Its not perfect)
Basically what I did was I took the part from my tool and put it into ReplicatedStorage and then I clone it to the tool when the player equips it and I also set the NetworkOwner of the part to the player.
Basically what this does is when you first equip it, its broken. After you unequip and equip again, it works fine for the rest of the game. I had multiple boxes so each one would break on the first equip then go back to normal.
My second fix was to wait(0.05) after the player equips the tool THEN set the Part0 & Part1 of the Motor6D to the player. I’m guessing you cannot set Part0&1 for a short amount of time after the player equips the tool. Here is my code:
local Player = script:FindFirstAncestorWhichIsA("Player")
local RPS = game:GetService("ReplicatedStorage")
script.Parent.Equipped:Connect(function()
local fakebox = RPS:WaitForChild("fakebox"):Clone()
fakebox.Parent = script.Parent
fakebox:SetNetworkOwner(Player)
Anim = Player.Character.Humanoid.Animator:LoadAnimation(script.Animation)
Anim:Play()
Player.Character.Humanoid.WalkSpeed = 11
Player.Character.Humanoid.JumpPower = 0
wait(0.05)
script.fakebox.Parent = Player.Character.Torso
Player.Character.Torso.fakebox.Part0 = Player.Character.Torso
Player.Character.Torso.fakebox.Part1 = script.Parent.fakebox
end)
script.Parent.Unequipped:Connect(function()
if Player.Character.Torso:FindFirstChild("fakebox") then
script.Parent.fakebox:Destroy()
Player.Character.Torso.fakebox.Parent = script
script.fakebox.Part0 = nil
script.fakebox.Part1 = nil
end
Anim:Stop()
Player.Character.Humanoid.WalkSpeed = 16
Player.Character.Humanoid.JumpPower = 50
end)
Like I said its more of a bandaid fix. If you spam all the boxes the box wont even show up because of the wait(), but at least I got it so its not broken on the first equip. I’ll just have to wait till I find a better fix. Here’s the game: https://www.roblox.com/games/132707947/ieatcrayons05s-Place-2