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

CharacterAppearanceLoaded not firing sometimes?

Asked by 7 years ago
Edited 7 years ago
------------------
--[DECLARATIONS]--
------------------

----/[SERVICES]\----
local plrs = game:GetService("Players")
local repStore = game:GetService("ReplicatedStorage")

----/[REMOTES]\----
local charLoaded = repStore:WaitForChild("CharacterHasLoaded")

------------------
--[SCRIPT LOGIC]--
------------------

--A player has joined
plrs.PlayerAdded:Connect(function(plr)
    print("PLAYER HAS BEEN ADDED, PLR:",plr)
    --Fire charLoaded if the character of the player has loaded
    plr.CharacterAppearanceLoaded:Connect(function(char)
        print("Player's character has loaded! Player:",plr,",applying delay...")
        wait(2)

        print("Delay applyed! Firing event for ",plr)
        --Fire event
        charLoaded:InvokeClient(plr,char)
    end)
end)

So, every time the player's character loads, it will fire a RemoteEvent to the player.

It works fine, though sometimes. I've been told by some of the players who played my game, that in random moments, this won't work.

I've been testing with these players, and I've noted that, in some cases, the print in Line 21 won't fire(which means that, CharacterAppearanceLoaded has not fired), when they reset or join the game, while I was using the in-game console.

The system I've made seem to work flawlessly for me, but not for some players.

0
Depending on how important loading the character appearance is you could make it override the wait for appearance to load at some time (like 30 seconds) tkddude2 75 — 7y
0
You used InvokeClient, which is a YieldFunction of RemoteFunctions, not RemoteEvents. Validark 1580 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago

This doesn't really have to do with the scripting but useless parts in your game might cause it to be lagging. Move those useless parts to ServerStrorage

Ad
Log in to vote
0
Answered by
cabbler 1942 Moderation Voter
7 years ago

The event seems to not work sometimes. It might be better to do repeat wait(1/4) until Player:HasAppearanceLoaded()

Answer this question