Infinite yield possible on HumanoidRootPart?
Asked by
2 years ago Edited 2 years ago
So It works, the block and parry and more but when you died 1 time the sword will not work anymore. It says Infinite yield possible on HumanoidRootPart after dying 1 time. pls help me how to fix this
here the code:
001 | local sword = script.Parent |
002 | local attackRemote = script:WaitForChild( "Attack" ) |
003 | local blockRemote = script:WaitForChild( "Block" ) |
004 | local player = game.Players.LocalPlayer |
005 | local char = player.Character or player.CharacterAdded:Wait() |
007 | local hum = char:WaitForChild( "Humanoid" ) |
009 | local HumRP = char:WaitForChild ( "HumanoidRootPart" ) |
011 | local anims = script:WaitForChild( "Anims" ) |
012 | local equippedIdle = hum:LoadAnimation(anims:FindFirstChild( "IdleEquipped" )) |
014 | local RS = game:GetService( "ReplicatedStorage" ) |
015 | local UIS = game:GetService( "UserInputService" ) |
016 | local TS = game:GetService( "TweenService" ) |
019 | local Modules = RS:WaitForChild( "Modules" ) |
020 | local Remotes = RS:WaitForChild( "Remotes" ) |
022 | local runRemote = Remotes:WaitForChild( "Run" ) |
023 | local equipRemote = Remotes:WaitForChild( "Equip" ) |
025 | local RaycastHitbox = require(Modules:WaitForChild( "RaycastHitboxV4" )) |
030 | local M 1 Debounce = false |
032 | local isEquipped = false |
034 | local Animations = script:WaitForChild( "Animations" ) |
036 | local blockIdle = hum:LoadAnimation(Animations:FindFirstChild( "BlockIdle" )) |
041 | local isBlocking = player:WaitForChild( "isBlocking" ) |
057 | local m 1 HitStartDelay = { |
064 | local m 1 HitDuration = { |
071 | local M 1 Animations = { |
072 | [ 1 ] = hum:LoadAnimation(Animations:WaitForChild( "Attack1" )), |
073 | [ 2 ] = hum:LoadAnimation(Animations:WaitForChild( "Attack2" )), |
074 | [ 3 ] = hum:LoadAnimation(Animations:WaitForChild( "Attack3" )), |
075 | [ 4 ] = hum:LoadAnimation(Animations:WaitForChild( "Attack4" )) |
078 | sword.Equipped:Connect( function () |
081 | hitbox = RaycastHitbox.new(sword.Blade) |
083 | equipRemote:FireServer( "Equip" ) |
085 | local Params = RaycastParams.new() |
086 | Params.FilterDescendantsInstances = { char } |
087 | Params.FilterType = Enum.RaycastFilterType.Blacklist |
089 | hitbox.RaycastParams = Params |
091 | hitbox.OnHit:Connect( function (hit, humanoid) |
094 | if not humanoid.Parent:FindFirstChild( "Immune" ) then |
095 | attackRemote:FireServer(HumRP, humanoid, "Hit" , DoingCombo) |
101 | sword.Unequipped:Connect( function () |
108 | equipRemote:FireServer( "Unequip" ) |
110 | blockRemote:FireServer(HumRP, hum, "Unblock" ) |
114 | sword.Activated:Connect( function () |
115 | if not M 1 Debounce and not player:FindFirstChild( "isBlocking" ).Value and not char:FindFirstChild( "Disabled" ) then |
116 | runRemote:FireServer( "Walking" ) |
126 | delay(m 1 CDs [ DoingCombo ] , function () |
129 | M 1 Animations [ DoingCombo ] :Play() |
130 | elseif Combo = = 2 then |
139 | delay(m 1 CDs [ DoingCombo ] , function () |
142 | M 1 Animations [ DoingCombo ] :Play() |
143 | elseif Combo = = 3 then |
152 | delay(m 1 CDs [ DoingCombo ] , function () |
155 | M 1 Animations [ DoingCombo ] :Play() |
156 | elseif Combo = = 4 then |
160 | delay(m 1 CDs [ DoingCombo ] , function () |
163 | M 1 Animations [ DoingCombo ] :Play() |
166 | delay(m 1 HitStartDelay [ DoingCombo ] , function () |
168 | hitbox:HitStart(m 1 HitDuration [ DoingCombo ] ) |
169 | attackRemote:FireServer(HumRP, hum, "Trail" , DoingCombo, sword) |
175 | local blockInput = Enum.KeyCode.F |
177 | UIS.InputBegan:Connect( function (Input, IsTyping) |
178 | if IsTyping then return end |
179 | if isEquipped and CanBlock then |
180 | if Input.KeyCode = = blockInput then |
181 | if not player:FindFirstChild( "isBlocking" ).Value and not char:FindFirstChild( "Disabled" ) then |
182 | blockRemote:FireServer(hum, "Block" ) |
183 | runRemote:FireServer( "Walking" ) |
189 | UIS.InputEnded:Connect( function (Input, IsTyping) |
190 | if IsTyping then return end |
192 | if Input.KeyCode = = blockInput then |
193 | blockRemote:FireServer(hum, "Unblock" ) |
198 | hum.Died:Connect( function () |
199 | blockRemote:FireServer(hum, "Unblock" ) |
202 | isBlocking:GetPropertyChangedSignal( "Value" ):Connect( function () |
203 | if isBlocking.Value = = true then |
210 | blockRemote.OnClientEvent:Connect( function (canBlock, action) |
211 | local breakBlockAnim = hum:LoadAnimation(Animations:FindFirstChild( "BlockBroken" )) |
213 | if action = = "Break" then |
214 | breakBlockAnim:Play() |
216 | breakBlockAnim:Stop() |