So to mark it up here I have been stressing on this bug recently trying to convert my code into a framework it is quite successful until I ran to this issue
19:08:26.221 - Infinite yield possible on 'Workspace:WaitForChild("FerbZides")'
19:08:26.223 - Stack Begin
19:08:26.226 - Script 'Players.FerbZides.PlayerScripts.SCRIPTS.UIS', Line 79 - function Start
Code:
local Character = workspace:WaitForChild(Player.Name)
Its just so inaccurate of why it just doesn’t exist
PS:
Code or Module is place in StarterPlayer>StarterPlayerScripts
Fr this bug has been annoying me for months now and I cant get a single-ton solution for it
this is a weird way to get the character of a player
These are the most appropriate ways
if a LocalScript is in StarterPlayer.StarterPlayerScripts (as in your case) you should do this
local LocalPlayer = game:GetService("Players").LocalPlayer
LocalPlayer.CharacterAdded:Connect(function (character)
-- some code
end)
if a LocalScript is in StarterGui or StarterPack you should do this
local LocalPlayer = game:GetService("Players").LocalPlayer
local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
-- some code
in this case (LocalScript is in StarterPlayer.StarterPlayerScripts), this will fail when the player resets. Character will point to the character that was destroyed.
it is more convenient to place the modules in ReplicatedStorage
I don’t understand why you’re saying this. I’m just trying to be formal.
Exactly. I said more Convenient. Not Mandatory or Efficient
This will not work because when you reset your character, Character will refer to the character that was destroyed. If you do this Character == Player.Character after resetting the character, it will give you false.