Player.CharacterAdded:Connect(function(Char)
local M6D = Instance.new("Motor6D", Char.UpperTorso)
M6D.Name = "ToolGrip"
end)
and i get these errors:
ToolGrip is not a valid member of MeshPart "Workspace.LuiOG.UpperTorso"
``` - gun local script
```lua
Event.OnServerEvent:Connect(function(Player, Action, Location)
if Action == "Connect" then
local Character = Player.Character or Player.CharacterAdded:Wait()
Character.UpperTorso.ToolGrip.Part0 = Character.UpperTorso
Character.UpperTorso.ToolGrip.Part1 = Location
elseif Action == "Disconnect" then
local Character = Player.Character or Player.CharacterAdded:Wait()
Character.UpperTorso.ToolGrip.Part1 = nil
end
end)
``` - m6d connect event
from the error i see that your toolgrip isn’t a member of your character UpperTorso you might want to add waitforchild for your upper torso such as
local PlayerTorso = Char:WaitForChild("UpperTorso") -- making sure its loaded
local M6D = Instance.new("Motor6D")
M6D.Name = "ToolGrip"
M6D.Parent = PlayerTorso -- making sure to parent it
the waitforchild ensures that your Character UpperTorso will be loaded first before adding the M6D
and on the Script
Event.OnServerEvent:Connect(function(Player, YourToolLocation)
local Character = Player.Character or Player.CharacterAdded:Wait()
if Character.UpperTorso.ToolGrip ~= nil then ---Checking if your toolgrip exists
Character.UpperTorso.ToolGrip.Part0 = Character.UpperTorso -- connect it to your torso
Character.UpperTorso.ToolGrip.Part1 = YourToolLocation --connect it to your tool argument
end
end)