Script not printing after fired client and not working on local script

My scripts are not working properly how do i fix it?
ServerScript:

myNPC.npchum.Died:Connect(function()
	myNPC:Destroy()
	
	local armor = armorModule.chooseRandom()
	print(armor.Name)

game.Players.PlayerAdded:Connect(function(player)
	game.ReplicatedStorage.Events.UpdateInventory:FireClient(player, armor)
	print("Good")
	end)
end)

And local script:

local replicatedstorage = game:GetService("ReplicatedStorage")
	local function addToFrame(armor)
		local template = script.Parent.MainGui.Inventory.Templates.Template
		
		local newTemplate = template:Clone()
		newTemplate.Name = armor.Name
		newTemplate.Parent =  script.Parent.MainGui.Inventory.Duplicates
		newTemplate.Visible = true
		
		local newArmor = armor:Clone()
		
		local camera = Instance.new("Camera")
		camera.CFrame = CFrame.new(newArmor.PrimaryPart.Position + (newArmor.PrimaryPart.CFrame.lookVector * 3), newArmor.PrimaryPart.Position)
		camera.Parent = newTemplate.ViewportFrame
		
		newTemplate.ViewportFrame.CurrentCamera = camera
end

replicatedstorage.Events.UpdateInventory.OnClientEvent:Connect(function(player, armor)
	addToFrame(armor)
end)

Can you tell us what is suppose to happen and what actually happens along with the error you’re getting?

So im not getting any errors in the output but in the server script it only prints the armor’s name but not “good” and in the local script the local function doesn’t even do anything, the function was suppose to clone a gui with the armor details

add a print just before the event just to confirm that it is the remote event

FireClient isn’t a function. You’re imagining it as a function:

The correct way is:

game.Players.PlayerAdded:Connect(function(player)
	game.ReplicatedStorage.Events.UpdateInventory:FireClient(player, armor)
	print("Good")
end)

i meant the local function in the local script

yeah, also in your localscript remove the player parameter as it doesnt exist

1 Like

Does this work:

local PassedOn

myNPC.npchum.Died:Connect(function()
	myNPC:Destroy()

	local armor = armorModule.chooseRandom()
	PassedOn = armor
	print(armor.Name)
end)	
	
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function()
		game.ReplicatedStorage.Events.UpdateInventory:FireClient(player, PassedOn)
		print("Good")
	end)	
end)

Yeah I know, you should fix that error as well.

About your local script, I don’t think the first arguments of OnClientEvent() is always the player, it is what the argument that’s been passed from the server. So remove the player parameter and switch to armor and make sure you supply the addtoframe function with armor.