So, I'm trying to make a Jojo game and this is the stand handler in sss for my combat system. I got this error from the output when I tried to use the attack in testing mode. Here is what it said:
ServerScriptService.StandHandler:82: attempt to index nil with 'WaitForChild'
Here is the whole stand handler script (not a local script, a regular one.) the error line is number 82 :D
local TweenService = game:GetService("TweenService") local RunService = game:GetService("RunService") local mainFolder = game.ReplicatedStorage.StandFolder local Summon = mainFolder.RemoteEvents.Summon local Punching = mainFolder.RemoteEvents.Punching Summon.OnServerEvent:Connect(function(player, isActive) local char = player.Character local hrp = char.HumanoidRootPart if isActive == true then local Stand = mainFolder.Models.Stand:Clone() local mainPart = Stand.PrimaryPart Stand.Parent = char mainPart.CFrame = hrp.CFrame local weld = Instance.new("ManualWeld") weld.Name = "Weld" weld.Part0 = mainPart weld.Part1 = hrp weld.C0 = mainPart.CFrame:ToObjectSpace(hrp.CFrame) weld.Parent = weld.Part0 for i, bodyPart in pairs(Stand:GetChildren()) do if bodyPart:IsA("BasePart") and bodyPart ~= mainPart then local info = TweenInfo.new(0.45) local goal = {Transparency = 0} local tween = TweenService:Create(bodyPart, info, goal) tween:Play() end end local info = TweenInfo.new(0.5) local goal = {} goal.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame) goal.C1 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame * CFrame.new(-3, 1.5, 3)) local tween = TweenService:Create(weld, info, goal) tween:Play() local AnimControl = Stand.AnimationController local Idle = AnimControl:LoadAnimation(script.Animations.Idle) Idle:Play() else local Stand = char:FindFirstChild("Stand") local mainPart = Stand.PrimaryPart if Stand then if Stand.PrimaryPart:FindFirstChild("Weld") then local weld = Stand.PrimaryPart:FindFirstChild("Weld") for i, bodyPart in pairs(Stand:GetChildren()) do if bodyPart:IsA("BasePart") and bodyPart ~= mainPart then local info = TweenInfo.new(0.45) local goal = {Transparency = 1} local tween = TweenService:Create(bodyPart, info, goal) tween:Play() end end local info = TweenInfo.new(0.5) local goal = {} goal.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame) goal.C1 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame) local tween = TweenService:Create(weld, info, goal) tween:Play() tween.Completed:Connect(function() Stand:Destroy() end) end end end end) local char = ("Players").Character local Stand = char:WaitForChild("Stand") local LeanAnim = Stand.AnimationController:LoadAnimation(script:WaitForChild("Lean")) LeanAnim:Play() if Stand then RunService.Heartbeat:Connect(function() if ("hum").MoveDirection ~= Vector3.new(0,0,0) then LeanAnim:AdjustWeight(1.001) else LeanAnim:AdjustWeight(0) end end) end Punching.OnServerEvent:Connect(function(player, currentAttack) local char = player.Character local Stand = char:FindFirstChild("Stand") local weld = Stand.HumanoidRootPart:FindFirstChild("Weld") local combatModule = require(script.Combat) Stand.HumanoidRootPart.Massless = true if currentAttack == 1 then combatModule.Main(weld, TweenService, Stand, script.Animations.RightPunch, char, currentAttack) elseif currentAttack == 2 then combatModule.Main(weld, TweenService, Stand, script.Animations.LeftPunch, char, currentAttack) elseif currentAttack == 3 then combatModule.Main(weld, TweenService, Stand, script.Animations.Smash, char, currentAttack) end end)
I really hope someone can help with this