I want to make my animation not slow atfirst it load
my animation slow at first time play
I found a contentprovider but i have no idea how to sue it
local RS = game:GetService("ReplicatedStorage").Stuff.Rs.SkillRe
RS.OnServerEvent:Connect(function(player)
local char = player.Character
local hum = char:FindFirstChild("Humanoid")
local head = char:FindFirstChild("Head")
local leftarm = char:FindFirstChild("Left Arm")
local RightArm = char:FindFirstChild("Right Arm")
local HRP = char:FindFirstChild("HumanoidRootPart")
hum:LoadAnimation(game:GetService("ReplicatedStorage").Stuff.Animtion.Final):Play()
spawn(function()
local HL = game:GetService("ReplicatedStorage").Stuff.Effect.Highlight.Body:Clone()
local Light = game:GetService("ReplicatedStorage").Stuff.Effect.Light.Finallight:Clone()
local HLS = game:GetService("ReplicatedStorage").Stuff.Effect.Highlight.BlackLight:Clone()
local DayLight = game.Lighting
local motor6dd = Instance.new("Motor6D",head)
Light.Parent = head
motor6dd.Part0 = head
motor6dd.Part1 = Light
HLS.Parent = workspace
HL.Parent = char
DayLight.ClockTime = 0
HRP.Anchored = true
wait(1.5)
HRP.Anchored = false
DayLight.ClockTime = 12
HLS:Destroy()
Light:Destroy()
HL:Destroy()
end)
end)
1 Like
You should load the animation before firing the event because the animation takes some time to load and start playing.
2 Likes
so it’s like using contentprovider?
if that’s true i have no idea how to use it
You don’t need to use content provider to preload the asset.
You can wait for the animation to load first by assigning a variable to the loaded animation and waiting until it is loaded, then play it.
Can you make an example like writing a code for me so I can understand it?
Okay, here’s some example code:
local animation = humanoid.Animator:LoadAnimation(animation)
--Now that the animation is being loaded, we need to wait for it to finish.
local t = 0
while t < 1 do
--Wait a maximum of 1 second before deciding the animation will never load.
if animation.Length > 0 then break end
t+=task.wait()
end
--The animation is successfully loaded, or it has reached the max time of 1 second.
animation:Play()
1 Like
So I put this code in a script?
Like in ServerScriptService?
You replace your existing code to play the animation with the example, but changing the variables used accordingly. This means making the LoadAnimation
part of the code load the animation you want to load.
3 Likes
system
(system)
Closed
January 18, 2023, 5:29pm
9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.