I need help with this script

i want to archive boxing gloves in the right and left hand

the issue is when the tool is equipped the boxing gloves go on a dummy instead of characters

local plr = game.Players.LocalPlayer

local Char = plr.Character

local rbg = script.Parent.RightBoxingGlove
local lbg = script.Parent.LeftBoxingGlove

local plr = game.Players.LocalPlayer

local Char = plr.Character

local tool = script.Parent

tool.Equipped:Connect(function()
	local rweld = Instance.new("Weld")
	rweld.Part0 = Char.RightHand
	rweld.Part1 = rbg
	
	local lweld = Instance.new("Weld")
	lweld.Part0 = Char.RightHand
	lweld.Part1 = lbg
end)

image

Well, for one, you don’t have to refer to the LocalPlayer.

You can do, tool.Parent to find the Player as the tool is located inside of the player when equipped.

local plr = tool.Parent.Parent.Players

local Char = plr.Character

I don’t know but does any big happen when a variable is declared twice?

Uhm, just tool.Parent works to find the character.

local Char = tool.Parent

Is this in a local script if not then you might have issues

You have declared the variable plr and char twice in your script so you might want to delete that

If he were to do it in a local script, the damage to others would only show up for him; not others. That wouldn’t be good when you end up killing the other player and they don’t respawn, and they think that they killed you. It would get complicated.

yes, this is in a local script

Change it to a Script. LocalScripts shouldn’t be used too often in tools if the script is meant to be serverwide. Which, most tools are.

That’s not his issue he can have a separate script for the damage right

If he changes it to a script then the player cannot be identified

Yes; but it would be more streamlined to have it in one script; otherwise he would have to use RemoteEvents and in the end, more issues would arise.

The player can only be identified in a local script

Not true, I have used scripts before and they can define the player.

the script is working but when i equip the boxing gloves it goes on the dummy

Delete the dummy and see if it would work

local rbg = script.Parent.RightBoxingGlove
local lbg = script.Parent.LeftBoxingGlove

local tool = script.Parent

local Char = tool.Parent

tool.Equipped:Connect(function()
	local rweld = Instance.new("ConstraintWeld")
	rweld.Part0 = Char.RightHand
	rweld.Part1 = rbg
	 --position of leftthand should go here
	local lweld = Instance.new("ConstraintWeld")
	lweld.Part0 = Char.RightHand
	lweld.Part1 = lbg
    --position of righthand should go here
end)

That’s a basic idea of what I think the problem is.

it still doesnt work the boxing gloves

Make sure that you make the rbg.Position = Char.RightHand.Position

(Same goes for the other hand, just with the variables.)

Tell me if anything breaks.