Events.LoadAnimation.OnClientInvoke = function(animation)
return Animator:LoadAnimation(animation)
end
Still doesn’t work btw even If I parent the track to something it still returns nil
Also I know this is ugly if you know how to make it better looking tell me pls
local wait, spawn = task.wait, task.spawn
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local M1 = require(ReplicatedStorage:WaitForChild("M1"))
local Settings = require(ReplicatedStorage:WaitForChild("Settings"))
local Events = ReplicatedStorage:WaitForChild("Events")
local IsMouseButtonPressed = Events.IsMouseButtonPressed
local LoadAnimation = Events.LoadAnimation
local KJ = ReplicatedStorage:WaitForChild("KJ")
local Spawn = KJ:WaitForChild("Spawn")
local Moveset = {
Base = KJ.Base,
Ultimate = KJ.Ultimate
}
local Animator
Events.Input.OnServerEvent:Connect(function(Player, UserInputType, UserInputState)
if UserInputType == Enum.UserInputType.MouseButton1 then
repeat
M1(Player.Character)
wait()
until
not IsMouseButtonPressed:InvokeClient(Player, Enum.UserInputType.MouseButton1)
end
end)
Players.PlayerAdded:Connect(function(Player)
local Backpack = Player.Backpack
--local Animator = Character:FindFirstChildWhichIsA("Animator", true)
for _, move in Moveset.Base:GetChildren() do
move.Parent = Player.Backpack
end
--
Player.CharacterAdded:Connect(function(Character)
local HRP = Character:FindFirstChildWhichIsA("Humanoid").RootPart
Animator = Character:FindFirstChildWhichIsA("Animator", true)
if not Animator:GetAttribute("InProgress") then
-- ugly
local Phone = KJ:WaitForChild("Phone"):Clone()
local Handle = Instance.new("Motor6D")
Handle.Name = "Handle"
Handle.C0 = CFrame.new(-0.491, -0.704, -0.181)
Handle.Part0 = Character:WaitForChild("Right Arm")
Handle.Part1, Handle.Parent = Phone.Handle, Phone.Handle
Phone.Parent = Character
local track = LoadAnimation:InvokeClient(Player, Spawn) -- Animator:LoadAnimation(Spawn)
track.Priority = Enum.AnimationPriority.Action4
Animator:SetAttribute("InProgress", true)
track:Play()
HRP.Anchored = true
track:GetMarkerReachedSignal("PhoneBroke"):Once(function()
for i, v in Phone.Handle:GetChildren() do
v:Destroy()
end
local Impulse = Vector3.new(0.1, 0.1, 0.1)
Phone.Bottom.PrimaryPart:ApplyAngularImpulse(Impulse)
Phone.Top.PrimaryPart:ApplyAngularImpulse(Impulse)
for i, v in Phone:GetChildren() do
if v:IsA("Model") then
local primary = v.PrimaryPart
primary.Color = Color3.new()
primary.Material = Enum.Material.SmoothPlastic
end
end
end)
track.Stopped:Wait()
HRP.Anchored = false
Animator:SetAttribute("InProgress", false)
end
end)
end)
im not too familiar with coded animations & remote functions, but just to let you know: server-client-server functions are pretty risky. if the client’s end fails somehow (client lagged out, client left, etc) then the server’s going to throw an error too.
besides that, it’s a little hard to tell what youre trying to do without explaining it in words. i tried to read the code, but because its a lot, it would take me longer to figure it out by myself than for you to tell us what exactly this code is supposed to do.
also, patience man—we eventually get around most of the time, were just not always here, so : )
just from looking where the event was called in general, and what the event does—it looks like you told the client what animation to load (which is what is good), but thats all the event does. does the event tell the client to play the animation? only the server got code to play the animation, so it seems like only the server will know it needs to play it. hence, only animates in the server and not in the client.