You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I’m trying to follow a tutorial but every time I do it I get this very annoying error:
here’s the tutorial:
but incase you don’t want to go through it I’ll explain the issue.
I have this server script:
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local M6D = Instance.new("Motor6D")
M6D.Parent = char.UpperTorso
print(M6D.Parent)
M6D.Name = "ToolGrip"
print(M6D.Name)
if char.UpperTorso:FindFirstChild("ToolGrip") then
print("Good")
else
print("What")
end
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)
that is supposed to make a new motor6d named “ToolGrip” but it does not. I’ve tried different formatting and everything else, but to no avail. I even tried adding the motor6d on the server myself, and it did nothing.
Here’s the client script:
local Players = game:GetService("Players")
local WeaponTool = script.Parent.Pistol
local player = Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:Wait()
end
local char = character
print(char.Name)
print(character.Name)
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local HoldGunAnimation = Instance.new("Animation")
-- Set its "AnimationId" to the corresponding animation asset ID
HoldGunAnimation.AnimationId = "rbxassetid://7225805475"
local HoldGunAnimationTrack = animator:LoadAnimation(HoldGunAnimation)
script.Parent.Equipped:Connect(function()
game.ReplicatedStorage.ConnectM6D:FireServer(WeaponTool.BodyAttach)
char.UpperTorso.ToolGrip.Part0 = char.UpperTorso
char.UpperTorso.ToolGrip.Part1 = WeaponTool.BodyAttach
HoldGunAnimationTrack:Play()
end)
script.Parent.Unequipped:Connect(function()
game.ReplicatedStorage.DisconnectM6D:FireServer()
HoldGunAnimationTrack:Stop()
end)