Hello, I have the following script that is designed to load (or supposed to, lol) uniforms when a certain button is clicked. For reference, UniformLoader is a LocalScript located inside StarterGui, which serves the purpose of creating the UI. It also houses three BindableEvents, LoadFrench, LoadBritish, and LoadPrussian. The 'print("Receiver fired")' is only there for debugging purposes. This script itself is a Script located inside StarterCharacterScripts.
However, upon testing I get the following error. "Infinite yield possible on 'Players.cooldeath49.PlayerGui:WaitForChild("UniformLoader"). Does anyone know why?
local Character = script.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
local UniformLoader = Player.PlayerGui:WaitForChild("UniformLoader")
local Shirt = Player.Shirt.ShirtTemplate
local Pants = Player.Pants.PantsTemplate
local FrenchFired = UniformLoader:WaitForChild("LoadFrench")
local BritishFired = UniformLoader:WaitForChild("LoadBritish")
local PrussianFired = UniformLoader:WaitForChild("LoadPrussian")
function LoadFrench()
Shirt = "rbxassetid://1163144329"
Pants = "rbxassetid://1587606477"
print("Receiver fired")
end
function LoadBritish()
Shirt = "rbxassetid://1979891956"
Pants = "rbxassetid://1979911648"
print("Receiver fired")
end
function LoadPrussian()
Shirt = "rbxassetid://176660910"
Pants = "rbxassetid://176660953"
print("Receiver fired")
end
BritishFired.Event:Connect(LoadBritish)
PrussianFired.Event:Connect(LoadPrussian)
FrenchFired.Event:Connect(LoadFrench)
A response would be much appreciated! Thank you!

2 comments
Are you sure you have a child "UniformLoader" in the PlayerGui?
That's a warning not an error