VIDEO:
SERVER SCRIPT:
local myeventsfolder = replicatedstorage.MYEVENTS
local animationfolder = replicatedstorage.ANIMATIONS
myeventsfolder.FINISHER.OnServerEvent:Connect(function(player, enemycharacter:Model)
local maincharacter = player.Character
local mainhumanoid:Humanoid = maincharacter:FindFirstChild("Humanoid")
local enemyhumanoid:Humanoid = enemycharacter:FindFirstChild("Humanoid")
enemyhumanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
local enemytakedown = animationfolder.VICTIMFINISHER
local mctakedown = animationfolder.MCFINISHER
local enemyanimator:Animator = enemyhumanoid:FindFirstChild("Animator")
local mainanimator:Animator = mainhumanoid:FindFirstChild("Animator")
if enemyhumanoid and mainhumanoid then
mainhumanoid.WalkSpeed = 0 ; enemyhumanoid.WalkSpeed = 0 ; mainhumanoid.JumpHeight = 0 ; enemyhumanoid.JumpHeight = 0
local animtrack1 = mainanimator:LoadAnimation(mctakedown)
local animtrack2 = enemyanimator:LoadAnimation(enemytakedown)
animtrack1.Priority = Enum.AnimationPriority.Action4
animtrack2.Priority = Enum.AnimationPriority.Action4
enemycharacter.PrimaryPart.CFrame = maincharacter.PrimaryPart.CFrame * CFrame.new(0, 0, -3)
animtrack1:Play();animtrack2:Play()
wait(1.7)
animtrack2:AdjustSpeed(0) ; animtrack1:AdjustSpeed(0)
local sound = Instance.new("Sound", enemycharacter.Head)
sound.SoundId = "rbxassetid://9113800060"
sound.Volume = 100
sound.RollOffMaxDistance = 9
sound:Play()
wait(3)
animtrack2:Stop() ; animtrack1:Stop()
enemyhumanoid.Health -= 10
mainhumanoid.WalkSpeed = 16
mainhumanoid.JumpHeight = 7.2
local deadanimtrack = enemyanimator:LoadAnimation(animationfolder.STUNNED)
deadanimtrack.Priority = Enum.AnimationPriority.Action4
deadanimtrack:Play()
wait(1.25)
deadanimtrack:AdjustSpeed(0)
return
end
end)
**LOCAL SCRIPT:**
local character = script.Parent
local uis = game:GetService("UserInputService")
local remotefunction = game.ReplicatedStorage.MYEVENTS.FINISHER
local db = true
uis.InputBegan:Connect(function(input, gpe)
if input.KeyCode == Enum.KeyCode.R and not gpe then
local raycastparams = RaycastParams.new()
raycastparams.FilterDescendantsInstances = {character:GetChildren()}
raycastparams.FilterType = Enum.RaycastFilterType.Exclude
local raycastresult = workspace:Raycast(character.HumanoidRootPart.Position, character.HumanoidRootPart.CFrame.LookVector * 3, raycastparams)
if raycastresult then
print(Vector3.new(math.round(raycastresult.Normal.X), math.round(raycastresult.Normal.Y), math.round(raycastresult.Normal.Z)))
local enemycharacter = raycastresult.Instance.Parent
remotefunction:FireServer(enemycharacter)
end
end
end)