Need help scripting Placing Tower (Tower defense game)

Hello I am new scripter here I try making Tower defense game Project but look like my script so bad
I try to fix it myself but it keep error and error

local ReplicatedStroage = game:GetService("ReplicatedStorage")
local PlaceTower = game.ReplicatedStorage:WaitForChild("PlaceTower")
local Tower = game.ReplicatedStorage:WaitForChild("PreTower")
local PlaceLable = game.Workspace.PlaceLable

local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local Player = game.Players.LocalPlayer
local TowerMenu = script.Parent.TowerMenu
local char = Player.Character or Player.Character:Wait()
local HumanoidRootPartA = char:WaitForChild("HumanoidRootPart")

local Mouse = Player:GetMouse()

local Ybuildingoffset = 5
local MaxPlacingDistance = 50
local rKeyIsPressed = false
local PlacingTower = false

for _, TowerButton in pairs(TowerMenu:GetChildren()) do
	if TowerButton:IsA("ImageButton") then
		TowerButton.MouseButton1Up:Connect(function()
			
			TowerMenu.Visible = false
			
			local yOrientation = 0
			local GoodToPlace = false
			local PlacedTower
			
			if PlacingTower == false then
				PlacingTower = true
				local ClientTower = Tower:FindFirstChild(TowerButton.Name):Clone()
				ClientTower.RangeArea.BrickColor = BrickColor.new("Cyan")
				ClientTower.RangeArea.Material = "Neon"
				ClientTower.RangeArea.CanCollide = false
				ClientTower.Parent = game.Workspace
				
				local StartingCFrame = CFrame.new(0, -2, -15)
				ClientTower.HumanoidRootPart.CFrame = HumanoidRootPartA.CFrame:ToWorldSpace(StartingCFrame)
				
				RunService.RenderStepped:Connect(function()
					local MouseRay = Mouse.UnitRay
					local CastRay = Ray.new(MouseRay.Origin, MouseRay.Direction * 1000)
					local IgnoreList = {ClientTower, char}
					local hit, position = Workspace:FindPartOnRayWithIgnoreList(CastRay, IgnoreList)
					local RangeAreaB = ClientTower:FindFirstChild("RangeArea")
					
					if hit and (hit:IsA(PlaceLable) or hit.Name:Floor() == PlaceLable) and (HumanoidRootPartA.Position - ClientTower.WorldPivot.Position).magnitude < MaxPlacingDistance then
						GoodToPlace = true
						print(ClientTower)
						
					else
						
					end
					
					local NewanglesCFrame = CFrame.Angles(0, math.rad(yOrientation), 0)
					local NewCFrame = CFrame.new(position.X, position.Y + Ybuildingoffset, position.Z)
					ClientTower.HumanoidRootPart.CFrame = NewCFrame * NewanglesCFrame
				end)
				
				UIS.InputBegan:Connect(function(input)
					if input.KeyCode == Enum.KeyCode.R then
						rKeyIsPressed = true
						
						local rotationspeed = 5
						while rKeyIsPressed do
							wait()
							if PlacingTower == true then
								yOrientation = yOrientation + rotationspeed
							end
						end
					end
				end)
				UIS.InputEnded:Connect(function(input)
					if input.KeyCode == Enum.KeyCode.R then
						rKeyIsPressed = false
					end
				end)
				
				UIS.InputBegan:Connect(function(input)
					if input.UserInputType == Enum.UserInputType.MouseButton1 then
						if PlacingTower == true then
							if GoodToPlace == true then
								local TowerCFrame = ClientTower.HumanoidRootPart.CFrame
								PlacedTower = PlaceTower:InvokeServer(ClientTower.Name, TowerCFrame)
								
								if PlacingTower == true then
									PlacingTower = false
									ClientTower:Destroy()
									TowerMenu.Visible = true
		ClientTower.HumanoidRootPart.RangeAreaTrick:Destroy()
								end
							end
						end
					end
				end)
				
			end
		end)
	end
end

Untitled


I am new Devforum here so if I do anything wrong im sorry

As you can see in the error, the HumaniodRootPart is not a part of the tower. Why should it be?
Try asking for the humanoidrootpart in the proper location or ask for a valid member.

You are doing really well for a first timer! My first 2 posts got removed once. In fact yur post is one of the clearest ive seen

As star said it appears the issue is in the output

Try doing a :WaitForChild(“HumanoidRootPart”) maybe? or maybe it’s just a typo?