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

How come this works sometimes? PlayerAdded/CharacterAdded??

Asked by
NotPix 2
7 years ago

Seems to work fine, then sometime doesn't even work at all?

game.Players.PlayerAdded:connect(function(player)
local Data = script.Data:Clone()
Data.Parent = player
local CopyData = script.Data.leaderstats:Clone()
CopyData.Parent = player
    --stat() 
    player.CharacterAdded:connect(function(char)    
    if char:WaitForChild("Humanoid") then
        update()    
        wait(6)
        Change_Clothes(char);
        Insert_FallDmg(char); -- Enables Damage_On_Fall 
        Insert_Ragdoll(char); -- Enables Death_Animation
        Insert_Blood(char);
        Insert_Sprint(char);
        Hat_Despawn(char)
        if isAuthenticated(player) then
        print(player.Name .. " has bought the game pass with id " .. passId)
        game.ReplicatedStorage.Weapons.M1014:Clone().Parent = player.Backpack
        player.Data.Inventory.M1014.Value = 1
        char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 50
        char.Humanoid.Health = char.Humanoid.Health + 50
        end
    end
    end)
    --setupPlayerData(player)   
    CheckBadges(player)
end)
0
Seems like when I go and add something to the game it breaks? as weird as that sounds NotPix 2 — 7y
0
try using childadded and checking if it's a player V_ChampionSSR 247 — 7y
0
Doing 'if char:WaitForChild("Humanoid") then' is pointless. OldPalHappy 1477 — 7y
0
I think we need more data. Do you get any errors, what do you mean by 'It's not working'?' OldPalHappy 1477 — 7y
View all comments (4 more)
0
I don't understand why its doing it, never touched the script! I'll try remove if:char:WaiForChild("Humanoid") then line. NotPix 2 — 7y
0
Can't even update my place now without it breaking... Looks like i'm reverting the verison ffs:( NotPix 2 — 7y
0
If you are testing on studio, that *probably* has something to do with it. Sometimes, in studio, the player is added before the script runs. Try testing in game, and see if it still doesn't work. Netflixy 126 — 7y
0
try removing the wait(6) a LearnBeginnersLua -2 — 7y

Answer this question