I’m trying to get a KeyframeSequence play when a function is fired. So far it’s working but the only thing that isn’t working is the animation.
I’d rather just not upload animations for now so I can send the gamefile to friends without them having to upload animations.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local interactionEvent = ReplicatedStorage:WaitForChild("Interact")
local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local function setAnim(model,animName)
local hashId = KeyframeSequenceProvider:RegisterKeyframeSequence(model.AnimSaves[animName])
local Animation = Instance.new("Animation")
Animation.AnimationId = hashId
if model:FindFirstChild("Humanoid") then
return model.Humanoid:LoadAnimation(Animation)
else
return model.AnimationController:LoadAnimation(Animation)
end
end
local animController = setAnim(script.Parent,"pickup")
local function OnEvent(message)
animController:Play()
end
interactionEvent.Event:Connect(OnEvent)