Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Script not cloning when a player joins?

I have a value in a folder called PlayerStats called Career. It says their career I guess is what it is. Anyways this script here, which is just supposed to clone a script that sits in replicatedstorage into the players gui does not clone when it should. No output errors.

function onPlayerEntered(player)
	if player:WaitForChild("PlayerStats").Career.Value == "CEO" then
		local cc = game.ReplicatedStorage.CEO:Clone()
		cc.Parent = player.PlayerGui
	end
end

game.Players.PlayerAdded:connect(onPlayerEntered)

Whats the issue here? Any help is appreciated.

Edit: Title Typo

1 comment

0

Ever tried something called "print debugging"?

1 answer

if player:WaitForChild("PlayerStats").Career.Value == "CEO" then

Make sure its the correct path. Perhaps the player does not have an object named 'PlayerStats'. This is often the case for me when this happens. If there are no errors, its either the if statement not triggering, or the script is disabled.

This discussion is preserved as it was. New answers, comments, and votes are closed.