Trouble with Server Event, and accessory

Hello, everyone! My name is Oliver and I’m currently having trouble with a script that I was given by a developer of mine. I was attempting to put it into a GUI for our law enforcement officers, but I was having trouble. I will now explain what I’m attempting to do. I’m attempting to make it so when one of our officers clicks the gui it will give them latex gloves, but I was having trouble with the script. There is one error in output and it says “Error, RightArm is not a valid member of 36bandzz.” Tell me if you can help, I’ll leave the script below

Server Sided Script

local GetGlove = game:GetService("ReplicatedStorage").GetGloves

GetGlove.OnServerEvent:Connect(function(Player, Needed)
	if Player.Character:FindFirstChild("LeftArm") then
		Player.Character.LeftArm:Destroy()
		Player.Character.RightArm:Destroy()
	else
		local hit = Player.Character.Torso
		if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("RightArm") == nil then
			local g = script.RightArm:clone()
			g.Parent = hit.Parent
			local C = g:GetChildren()
			for i=1, #C do
				if C[i].className == "Part" or "Union" then
					local W = Instance.new("Weld")
					W.Part0 = g.Middle
					W.Part1 = C[i]
					local CJ = CFrame.new(g.Middle.Position)
					local C0 = g.Middle.CFrame:inverse()*CJ
					local C1 = C[i].CFrame:inverse()*CJ
					W.C0 = C0
					W.C1 = C1
					W.Parent = g.Middle
					g.Middle.Transparency = 1
				end
				local Y = Instance.new("Weld")
				Y.Part0 = hit.Parent["Right Arm"]
				Y.Part1 = g.Middle
				Y.C0 = CFrame.new(0, 0, 0)
				Y.Parent = Y.Part0
			end

			local h = g:GetChildren()
			for i = 1, # h do
				h[i].Anchored = false
				h[i].CanCollide = false
			end

		end
		
	end
end)

GetGlove.OnServerEvent:Connect(function(Player, Needed)
	if Player.Character:FindFirstChild("LeftArm") then
		Player.Character.LeftArm:Destroy()
		Player.Character.RightArm:Destroy()
	else
		local hit = Player.Character.Torso
		if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("LeftArm") == nil then
			local g = script.LeftArm:clone()
			g.Parent = hit.Parent
			local C = g:GetChildren()
			for i=1, #C do
				if C[i].className == "Part" or "Union" then
					local W = Instance.new("Weld")
					W.Part0 = g.Middle
					W.Part1 = C[i]
					local CJ = CFrame.new(g.Middle.Position)
					local C0 = g.Middle.CFrame:inverse()*CJ
					local C1 = C[i].CFrame:inverse()*CJ
					W.C0 = C0
					W.C1 = C1
					W.Parent = g.Middle
					g.Middle.Transparency = 1
				end
				local Y = Instance.new("Weld")
				Y.Part0 = hit.Parent["Left Arm"]
				Y.Part1 = g.Middle
				Y.C0 = CFrame.new(0, 0, 0)
				Y.Parent = Y.Part0
			end

			local h = g:GetChildren()
			for i = 1, # h do
				h[i].Anchored = false
				h[i].CanCollide = false
			end

		end
	end
end)

Client Sided Script

local LatexButton = script.Parent.LatexButton
local Player = game.Players.LocalPlayer
local LatexFire = game:GetService("ReplicatedStorage").GetGloves

LatexButton.MouseButton1Click:Connect(function()
	if Player:IsInGroup(9499290) or Player:IsInGroup(9505797) then
		print("Group Valid")
		LatexFire:FireServer("Accepted")
	else
		LatexFire:FireServer("Denied")
	end
end)

Thanks if you can help, sorry for wasting your time if you can’t.

What line does it say the error is on.

It says the error is on line 6.

Is your game R6 or R15? If it’s R6, I think you need to add a space between LeftArm and RightArm because they have a space in them on R6 characters.

Screenshot_2

Try and see if this works

local GetGlove = game:GetService("ReplicatedStorage").GetGloves

GetGlove.OnServerEvent:Connect(function(Player, Needed)
	if Player.Character:FindFirstChild("LeftArm") then
		Player.Character.LeftArm:Destroy()
	else
		local hit = Player.Character.Torso
		if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("RightArm") == nil then
			local g = script.RightArm:clone()
			g.Parent = hit.Parent
			local C = g:GetChildren()
			for i=1, #C do
				if C[i].className == "Part" or "Union" then
					local W = Instance.new("Weld")
					W.Part0 = g.Middle
					W.Part1 = C[i]
					local CJ = CFrame.new(g.Middle.Position)
					local C0 = g.Middle.CFrame:inverse()*CJ
					local C1 = C[i].CFrame:inverse()*CJ
					W.C0 = C0
					W.C1 = C1
					W.Parent = g.Middle
					g.Middle.Transparency = 1
				end
				local Y = Instance.new("Weld")
				Y.Part0 = hit.Parent["Right Arm"]
				Y.Part1 = g.Middle
				Y.C0 = CFrame.new(0, 0, 0)
				Y.Parent = Y.Part0
			end

			local h = g:GetChildren()
			for i = 1, # h do
				h[i].Anchored = false
				h[i].CanCollide = false
			end

		end
		
	end
end)

GetGlove.OnServerEvent:Connect(function(Player, Needed)
	if Player.Character:FindFirstChild("RightArm") then
		Player.Character.RightArm:Destroy()
	else
		local hit = Player.Character.Torso
		if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("LeftArm") == nil then
			local g = script.LeftArm:clone()
			g.Parent = hit.Parent
			local C = g:GetChildren()
			for i=1, #C do
				if C[i].className == "Part" or "Union" then
					local W = Instance.new("Weld")
					W.Part0 = g.Middle
					W.Part1 = C[i]
					local CJ = CFrame.new(g.Middle.Position)
					local C0 = g.Middle.CFrame:inverse()*CJ
					local C1 = C[i].CFrame:inverse()*CJ
					W.C0 = C0
					W.C1 = C1
					W.Parent = g.Middle
					g.Middle.Transparency = 1
				end
				local Y = Instance.new("Weld")
				Y.Part0 = hit.Parent["Left Arm"]
				Y.Part1 = g.Middle
				Y.C0 = CFrame.new(0, 0, 0)
				Y.Parent = Y.Part0
			end

			local h = g:GetChildren()
			for i = 1, # h do
				h[i].Anchored = false
				h[i].CanCollide = false
			end

		end
	end
end)

Change this to if Player.Character:FindFirstChild("LeftArm") and Player.Character:FindFirstChild("RightArm") then

1 Like

It’s R6. Also The name is “LeftArm” not “Left Arm.” Like I said I’m trying to make gloves and the glove names are “LeftArm” and “RightArm”.

Oh, I see. My apologies, that makes a lot more sense why the arms were being destroyed lol

np, lol. Sorry if I sounded angry, thats just how I sound lol.

You didn’t sound angry at all, you’re fine

Testing Now. Doubt it will work though as I have tried this before.

Tried, Unfortunately it did not work. Any other ideas?

Did you get any new errors or is it still the same?