Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script not cloning when a player joins?

Asked by 6 years ago
Edited 6 years ago

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

0
Ever tried something called "print debugging"? hiimgoodpack 2009 — 6y

1 answer

Log in to vote
1
Answered by
H4X0MSYT 536 Moderation Voter
6 years ago
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.

Ad

Answer this question