I have this GUI that plays an animation to the user via server.
It works, but once I move and click the Button again it doesn’t play the animation anymore.
My Script:
-- ServerScriptService
local RP = game:GetService("ReplicatedStorage")
local event = RP:WaitForChild("TestEvent")
event.OnServerEvent:Connect(function(sender)
local Character = sender.Character
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
local Animator = Humanoid:FindFirstChildOfClass("Animator")
if Humanoid and Animator then
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://3695333486"
Animator:LoadAnimation(Animation):Play() -- Play
print("Playing animation")
end
end)
-- Localscript
local RP = game:GetService("ReplicatedStorage")
local event = RP:WaitForChild("TestEvent")
script.Parent.MouseButton1Click:Connect(function()
event:FireServer()
end)
You go inside the Animation Editor and click the 3 dots on the upper left, then you click “Import” and “From Roblox”. Input the ID into the bottom and click “Submit”. Then you can set it’s priority from there.
I’ve gone and done that for you already, here is the ID: