Region3 Script not able to detect HitBox

Hello, So I created a HitBox and I put that hitbox Inside the character and whenever the region3 loops through all the parts inside it the player will get 1k coins but that does not work for some reason her is the HitBox Script
LOCAL SCRIPT

local HitBox = game.ReplicatedStorage.HitBox
local player = game.Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
	character = player.CharacterAdded:wait()
end
local Hum = character:WaitForChild("HumanoidRootPart")

HitBox.Parent = character

while true do
	wait()
	
	HitBox.CFrame = Hum.CFrame
		end

the HitBox works perfectly fine and the hitbox moves with the player.
here is the Region3 Script
SERVER SCRIPT

local part = script.Parent-- The region3

--local db = false

local region = Region3.new(part.Position - part.Size/2, part.Position + part.Size/2)-- Formula to get the measurements bottom and top of the region
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(plr)
	local char = plr.Character-- getting the char

	while true do 
		wait(1)
		local FindParts = game.Workspace:FindPartsInRegion3(region,part)-- BuiltInFunction to check if anything is inside the Region3
		for i,parts in pairs(FindParts) do-- looping through all objects are present in the region3
			print(parts.Name)
			if parts.Name == "HitBox" then 
			
				
				local Region3UI = game.StarterGui.Region3
				Region3UI.Enabled = true
					plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 1000 

					wait(1)
			
			
			else print("The part was not a valid child of char")
				local Region3UI = game.StarterGui.Region3
				Region3UI.Enabled = false

				end


			
		end
	end
end)

The thing is whenever the hitbox goes inside the region3 it still runs the print statement that says part is not a valid member.

It’s because you created the “Hitbox” object using the local script and it did not replicate to the server. What you want to do is put the Region3 script code to the local script instead of the server script. Also, if you are working with the GUI, using a local script is the best way to go.