Hey, so I have a localscript that I have put in my PlayerGui, and when I spawn in, the script works perfectly but when I reset / respawn, the script does not function anymore and there is no available output given from the script.

Would be appreciated if anybody could help. Thanks

RightArmEnabled = true
LeftArmEnabled = true
PackageSupport = true
ArmWidth = 1
Spets=false

function check()
local player = game.Players.LocalPlayer
if player.TeamColor == game.Teams.Spetsnaz.TeamColor then
Spets = true
end
end

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local ArmModel = nil
local watch

check()

watch=player.Changed:connect(function(ch)
	check()
	if ch=='AppearanceDidLoad' and Spets == true then
		ArmModel = Instance.new("Model", game.Workspace.CurrentCamera)
		ArmModel.Name = "PlayerArms"
		local ArmShape = Instance.new("Humanoid", ArmModel)
		if player.Character:FindFirstChild("Shirt") then
		if player.TeamColor == game.Teams.Spetsnaz.TeamColor then
			local Shirt = Instance.new("Shirt",ArmModel)
			Shirt.ShirtTemplate = "rbxassetid://520513541"
		end
		end
		--Left Arm
		
		check()
		
		if LeftArmEnabled == true and Spets == true then
			print("k")
			local Arm1 = Instance.new("Part", ArmModel)
			Arm1.Position = game.Players.LocalPlayer.Character["Left Arm"].Position
			Arm1.Name = "Left Arm"
			Arm1.FormFactor = "Custom"
			Arm1.Size = Vector3.new(ArmWidth, 2, ArmWidth)
			Arm1.CanCollide = false
			Arm1.BrickColor = BrickColor.new("Light orange")
			for i, v in pairs(player.Character:GetChildren()) do
				if v.ClassName == "CharacterMesh" then
					if v.BodyPart == Enum.BodyPart.LeftArm then
						local packarm = v:Clone()
						packarm.Parent = ArmModel
					end
				end
			end
			local Weld1 = Instance.new("Weld", ArmModel)
			Weld1.Part0 = Arm1
			Weld1.Part1 = game.Players.LocalPlayer.Character["Left Arm"]
		end
		--Right Arm
		
		check() 
		if RightArmEnabled == true and Spets == true then
			local Arm2 = Instance.new("Part", ArmModel)
			Arm2.Position = game.Players.LocalPlayer.Character["Right Arm"].Position
			Arm2.Name = "Right Arm"
			Arm2.FormFactor = "Custom"
			Arm2.Size = Vector3.new(ArmWidth, 2, ArmWidth)
			Arm2.CanCollide = false
			Arm2.BrickColor = BrickColor.new("Light orange")
			for i, v in pairs(player.Character:GetChildren()) do
				if v.ClassName == "CharacterMesh" then
					if v.BodyPart == Enum.BodyPart.RightArm then
						local packarm = v:Clone()
						packarm.Parent = ArmModel
					end
				end
			end
			local Weld2 = Instance.new("Weld", ArmModel)
			Weld2.Part0 = Arm2
			Weld2.Part1 = game.Players.LocalPlayer.Character["Right Arm"]
		end
		watch:disconnect()
	end
end)
repeat wait() until player.Character

1 comment

0

Do you have ResetPlayerGuiOnSpawn Enabled in StarterGui? If not, that's probably you're problem. You could try placing this script in StarterPack instead.