Why is my script saying an error that doesn't exist?

I want to fix my trashy game

My script is telling me it got “…” when I didn’t have “…” in my script.

Devforum

I am using my LocalScript and it just says I used “…” on line 9 when it is nowhere to be seen. I have this in the StarterPack and I need this error to go away so I can fix my game and make it work.

local plr = game.Players.LocalPlayer
local WeaponTool = script.Parent
local char = plr.Character or plr.CharacterAdded:Wait()

script.Parent.Equipped:Connect(function()

	game.ReplicatedStorage.ConnectM6D:FireServer(WeaponTool.Weapon)
	
	char:WaitForChild("Torso").ToolGrip.Part0 = char.Torso --This is where it says the error is
	char:WaitForChild("Torso").ToolGrip.Part1 = WeaponTool.Weapon

end)

WeaponTool.Unequipped:Connect(function()

	game.ReplicatedStorage.DisconnectM6D:FireServer()

end)
1 Like

Could you send us the actual error message?

Can’t you just name “Weapon” to “Handle”?

No since I am animating the weapon with Motor6D’s so Handle will break it

And no I have to get off of studio for a while, just want help

How is the Motor6D added? through a script or is it a StarterCharacter?

This might fix it:

local WeaponTool = script.Parent
local char = plr.Character or plr.CharacterAdded:Wait()

script.Parent.Equipped:Connect(function()
	local ToolGrip = char.Torso:FindFirstChild("ToolGrip")
	if not ToolGrip then
		ToolGrip = Instance.new("Motor6D", char:WaitForChild("Torso"))
		ToolGrip.Name = "ToolGrip"
	end

	game.ReplicatedStorage.ConnectM6D:FireServer(WeaponTool.Weapon)

	ToolGrip.Part0 = WeaponTool.Weapon
	ToolGrip.Part1 = char.Torso

end)

WeaponTool.Unequipped:Connect(function()

	game.ReplicatedStorage.DisconnectM6D:FireServer()

end)