Problem with cloning objects to the player (again)

Good morning users, I still have the same problem of cloning objects for the player, the script doesn’t seem to work I don’t know why.

The script:

local PlayerValues = game.ServerStorage:WaitForChild(“PlayerValues”)

game.Players.PlayerAdded:Connect(function(player)

PlayerValues:Clone().Parent = player

end)

Seems to work perfectly for me
image

I found out if I only do that part in a separate script, the function already works but I don’t understand why, I will now show the full script, I don’t understand why it doesn’t work:

The CompletScript

wait()

local Workspace = game:GetService(“Workspace”)

local Players = game:GetService(“Players”)

local CoreGui = game:GetService(“CoreGui”)

local Lighting = game:GetService(“Lighting”)

local NetworkServer = game:GetService(“NetworkServer”)

local ReplicatedFirst = game:GetService(“ReplicatedFirst”)

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)

local ServerScriptService = game:GetService(“ServerScriptService”)

local ServerStorage = game:GetService(“ServerStorage”)

local StarterGui = game:GetService(“StarterGui”)

local StarterPack = game:GetService(“StarterPlayer”)

local StarterPlayer = game:GetService(“StarterPlayer”)

local StarterCharacterScripts = game:GetService(“StarterCharacterScripts”)

local StarterPlayerScripts = game:GetService(“StarterPlayerScripts”)

local SoundService = game:GetService(“SoundService”)

local Chat = game:GetService(“Chat”)

local LocalizationService = game:GetService(“LocalizationService”)

local TestService = game:GetService(“TestService”)

local UserInputService = game:GetService(“UserInputService”)

–PlayerStorage

local PlayerValues = game.ServerStorage:WaitForChild(“PlayerValues”)

Players.PlayerAdded:Connect(function(player)

PlayerValues:Clone().Parent = player

end)

because it works but if I put what I put before the function it doesn’t seem to work

After adding all this is still seemed to work for me, quick question
Is your a local script or a normal script
Are there any errors in your output?

there are no errors if I put any message inside the function it does not work, I am doing a server script on serverscriptservice, besides there are no errors in the output.

I’m also doing this in roblox studio, I don’t know if the problem can come from there

You may be waiting for the child too long and yielding until after a player joins, check if this is true.

I’m new to these things, that is, I have to wait for a part of the script (I didn’t notice)