Right now I’m trying to make a very simple animated tool in roblox studio by following Stacky’s tutorial
How to animate Tool Parts (Guns, Knifes etc.). I believe I followed his guidelines exactly, but for some reason the “Gun” is not moving when I play the animation in game. While in the animator it animates just fine.
In Animator:
In Game:
These are the scripts that I’m using (Almost a copy&paste from Stacky’s scripts)
Client Side parented to the gun tool:
local WeaponTool = script.Parent
wait(.5)
local player = game.Players.LocalPlayer
local char = player.Character
local hum = char.Humanoid
local Mouse = player:GetMouse()
local anim = script.Parent.Fire
local animator = hum:WaitForChild("Animator")
local fire = animator:LoadAnimation(anim)
fire.Looped = false
local canFire = false
script.Parent.Equipped:Connect(function()
game.ReplicatedStorage.ConnectM6D:FireServer(WeaponTool.BodyAttach)
char.UpperTorso.ToolGrip.Part0 = char.UpperTorso
char.UpperTorso.ToolGrip.Part1 = WeaponTool.BodyAttach
canFire = true
end)
WeaponTool.Unequipped:Connect(function()
game.ReplicatedStorage.DisconnectM6D:FireServer()
canFire = false
end)
Mouse.Button1Down:Connect(function()
if canFire == true then
fire:play()
end
end)
And this is the server script in ServerScriptService.
game.Players.PlayerAdded:Connect(function(plr)
print("Player Being Added")
plr.CharacterAdded:Connect(function(char)
local M6D = Instance.new("Motor6D", char.UpperTorso)
M6D.Parent = char.UpperTorso
M6D.Name = "ToolGrip"
end)
end)
game.ReplicatedStorage.ConnectM6D.OnServerEvent:Connect(function(plr,location)
local char = plr.Character
char.UpperTorso.ToolGrip.Part0 = char.UpperTorso
char.UpperTorso.ToolGrip.Part1 = location
end)
game.ReplicatedStorage.DisconnectM6D.OnServerEvent:Connect(function(plr)
plr.Character.UpperTorso.ToolGrip.Part1 = nil
end)