Hello so basically i made a hostage system with two buttons. Release, Shoot. Whenever u pick the shoot player the animations afterwards stop however, when i firstly Release and then again do shoot button the BeingHeldHostage animation wont stop. No errors in output
local BeingHeld = ReplicatedStorage.Animations:WaitForChild(“BeingHeld”):Clone()
local HoldingHostage = ReplicatedStorage.Animations:WaitForChild(“HoldingHostage”):Clone()
wait(0.05)
local BeingHeldLoaded = humanoid:WaitForChild("Animator"):LoadAnimation(BeingHeld)
local HoldingHostageLoaded = captorhumamnoid:WaitForChild("Animator"):LoadAnimation(HoldingHostage)
--local BeingHeldLoaded = humanoid:LoadAnimation(BeingHeld)
--local HoldingHostageLoaded = captorhumamnoid:LoadAnimation(HoldingHostage)
--local BeingHeldLoaded = humanoid:WaitForChild("Animator"):LoadAnimation(BeingHeld)
--local HoldingHostageLoaded = captorhumamnoid:WaitForChild("Animator"):LoadAnimation(HoldingHostage)
--HostageEvent:FireClient(player)
--print("EVENT FIRED")
--HostageEvent:FireClient(captorplayer)
--print("EVENT 2 FIRED")
--//
--local BeingHeldLoaded = humanoid:WaitForChild("Animator"):LoadAnimation(BeingHeld)
--local HoldingHostageLoaded = captorhumamnoid:WaitForChild("Animator"):LoadAnimation(HoldingHostage)
--local HostageShootLoaded = captorhumamnoid:WaitForChild("Animator"):LoadAnimation(HoldingHostage)
HostageEvent:FireClient(player,captorplayer)
print("EVENT FIRED")
--//
--// SFX //--
local SFX = script.Parent.SFX
SFX:Play()
wait(0.3)
BeingHeldLoaded:Play()
HoldingHostageLoaded:Play()
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
--character.HumanoidRootPart.Anchored = true
local LastTargetPosition = captorhumamnoid.RootPart.CFrame
local Length = 3 -- Length between player and target player
humanoid.RootPart.CFrame = LastTargetPosition + LastTargetPosition.LookVector * Length
humanoid.RootPart.CFrame = CFrame.new(humanoid.RootPart.CFrame.Position, Vector3.new(LastTargetPosition.Position.X, humanoid.RootPart.CFrame.Position.Y, LastTargetPosition.Position.Z))
character.HumanoidRootPart.CFrame *= CFrame.Angles(0, math.rad(180), 0)
--character.Head.face.Texture = "rbxassetid://258192246"
captorhumamnoid.WalkSpeed = 11
--// WELDING //--
wait(0.5)
local weld = Instance.new("WeldConstraint")
weld.Parent = HumanoidRootPartCaptor
weld.Part0 = HumanoidRootPartCaptor
weld.Part1 = HumanoidRootPartHostage
wait(1)
humanoid.PlatformStand = true
ShootEvent.OnServerEvent:Connect(function(player)
humanoid.PlatformStand = false
weld:Destroy()
wait(0.2)
humanoid.Health = humanoid.Health -100
local GunShot = Instance.new("Sound")
GunShot.SoundId = "rbxassetid://9119297274"
GunShot.Name = "GunShot"
GunShot.Volume = 7
GunShot.RollOffMinDistance = 100
GunShot.Parent = captorcharacter.Head
GunShot:Play()
local HeadSound = Instance.new("Sound")
HeadSound.SoundId = "rbxassetid://78527604620850"
HeadSound.Name = "HeadSound"
HeadSound.Volume = 4
HeadSound.RollOffMinDistance = 70
HeadSound.Parent = captorcharacter.Head
HeadSound:Play()
HoldingHostageLoaded:Stop()
BeingHeldLoaded:Stop()
captorplayer.PlayerGui.HostageGui.Release.Visible = false
captorplayer.PlayerGui.HostageGui.Shoot.Visible = false
local RattleSound = Instance.new("Sound")
RattleSound.SoundId = "rbxassetid://99467712370996"
RattleSound.Parent = character.Head
RattleSound:Play()
captorhumamnoid.WalkSpeed = 16
end)
ReleaseHostage.OnServerEvent:Connect(function(player)
humanoid.PlatformStand = false
weld:Destroy()
humanoid.WalkSpeed = 16
humanoid.JumpPower = 50
BeingHeldLoaded:Stop()
HoldingHostageLoaded:Stop()
script.Parent.MaxActivationDistance = 10
script.Parent.RequiresLineOfSight = false
captorhumamnoid.WalkSpeed = 16
captorplayer.PlayerGui.HostageGui.Release.Visible = false
captorplayer.PlayerGui.HostageGui.Shoot.Visible = false
end)
end)