but how do i make it play a random animation? here is what i came up with… (which wont work)
script.Parent.OnServerEvent:Connect(function(plr)
local hum = plr.Character:FindFirstChild("Humanoid")
local hit1 = hum:LoadAnimation(script.Parent.hit1)
local hit2 = hum:LoadAnimation(script.Parent.hit2)
local hit3 = hum:LoadAnimation(script.Parent.hit3)
local r = math.random(1,3)
if r == 1 then
hit1:Play()
end
if r == 2 then
hit2:Play()
end
if r == 3 then
hit3:Play()
end
end)
``
This is healthChanged And You need the humanoid refrenced this is a script not a local script and it is located in StarterCharacterScripts.
=====METHOD2 CZO’s METHOD
This is a cleaned up version of czo’s method and it also runs from a normal script not a local please Remember all can be easily transitioned to local scripts!