dukzae
(dukzae)
April 6, 2022, 7:07am
#21
The LocalScript should be under StarterPlayer.StarterCharacterScripts and look like this:
local sound = workspace.Sound
local animation = script:WaitForChild('Dance')
local humanoid = script.Parent:WaitForChild('Humanoid')
local animator = humanoid:WaitForChild("Animator")
local dance = animator:LoadAnimation(animation)
sound:GetPropertyChangedSignal("PlaybackLoudness"):Connect(function()
print(sound.PlaybackLoudness)
end)
dance:Play()
dance.Looped = true
vxsqi
(vxsqi)
April 6, 2022, 7:13am
#22
Thatâs weird. I thought local scripts cant play animations. Also the changedsignal event doesnât print out the value.
vxsqi
(vxsqi)
April 6, 2022, 7:15am
#23
I think the issue here is unsolved, but I donât need to worry about it anymore since I changed to a runservice event.
dukzae
(dukzae)
April 6, 2022, 7:15am
#24
As long as itâs their own character, thatâs the ideal implementation
Should I load an Animation on the client or server?
In order for AnimationTracks to replicate correctly, itâs important to know when they should be loaded on the client (via a LocalScript
) or on the server (via a Script
).
If an Animator
is a descendant of a Humanoid or AnimationController in a Playerâs Character
then animations started on that Playerâs client will be replicated to the server and other clients.
If the Animator is not a descendant of a player character, its animations must be loaded and started on the server to replicate.
The Animator object must be initially created on the server and replicated to clients for animation replication to work at all. If an Animator is created locally, then AnimationTracks loaded with that Animator will not replicate.
Both Humanoid:LoadAnimation() and AnimationController:LoadAnimation() will create an Animator if one does not already exist. When calling LoadAnimation from LocalScripts you need to be careful to wait for the Animator to replicate from the server before calling LoadAnimation if you want character animations to replicate. You can do this with WaitForChild(âAnimatorâ).
PlaybackLoudness wonât update if the sound isnât playing
dukzae
(dukzae)
April 6, 2022, 7:22am
#25
As a side note to sort of resolve the initial problem, is that the original âRemote event invocation queue exhaustedâ error happened when there was no script listening for .OnServerEvent
. The script you had probably wasnât running because it was not put into a container where it could run (or it was disabled).
1 Like