I know that infinite yield is just a warning but, it it doesn’t even do the local function. How do i fix this?
local replicatedstorage = game:GetService("ReplicatedStorage")
local armormodule = require(game.ServerScriptService:WaitForChild("ArmorHandler"))
local function addToFrame(armor)
local template = script.Parent.MainGui.Inventory.Templates.Template
local newTemplate = template:Clone()
newTemplate.Parent = script.Parent.MainGui.Inventory.Duplicates
newTemplate.Visible = true
local newArmor = armormodule.chooseRandom():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)