Weld Constraint acting in a weird way?

Hello, I was recently working on some tools that do specific things until I stumbled on this thing that’s shown in the picture. So what’s happening is that I scripted it so that whenever the player uses the tool selected in the picture it will swarm him with bees. I was trying to do that by welding a bunch of bees to a small invisible part, the part isn’t anchored and can collide is off, the same thing with bees. But when I create a new Weld constraint Instance and set Part0 to the Player’s HumanoidRootPart then set Part1 to the Model Main Part, when I do this happens and whenever the player moves the model moves too, but the distance between them is so far and the player sometimes glitch and starts moving in a weird way.

Local Script:

local tool = script.Parent
local ButterfliesRE = game.ReplicatedStorage:WaitForChild("ButterfliesRE")

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()

local isShowed = false

tool.Activated:Connect(function()
	if char:FindFirstChild("HumanoidRootPart") then
		
		local HRP = char:FindFirstChild("HumanoidRootPart")
		
		if isShowed then
			
			isShowed = false
			ButterfliesRE:FireServer(HRP,"hide")
		else
			isShowed = true
			ButterfliesRE:FireServer(HRP,"show")
		end
	end
end)

Server Script:

local re = game.ReplicatedStorage:WaitForChild("BeesRE")
local BeesModel = game.ReplicatedStorage:WaitForChild("BeeModel")
local PhysicsService = game:GetService("PhysicsService")
local runService = game:GetService("RunService")

local connection 

re.OnServerEvent:Connect(function(player,HRP,message)
	
	if message == "show" then
		
		local beeC = BeesModel:Clone()
		beeC.Parent = workspace
		beeC.MainPart.Anchored = false
		
		for i,v in pairs(beeC:GetDescendants()) do
			if v:IsA("Part") or v:IsA("MeshPart") then
				PhysicsService:SetPartCollisionGroup(v,"InvisibleParts")
			end
		end
		
		local weld = Instance.new("WeldConstraint")
		weld.Part0 = HRP
		weld.Part1 = beeC.MainPart
		weld.Parent = HRP
		
		--connection = runService.Stepped:Connect(function()
		--	beeC.MainPart.CFrame = HRP.CFrame
		--end)
		
	elseif message == "hide" then
		
		--if connection then
		--	connection:Disconnect()
		--end
		
		if HRP:FindFirstChild("WeldConstraint") then
			HRP.WeldConstraint:Destroy()
		end
		
		if workspace:FindFirstChild("BeeModel") then
			workspace.BeeModel:Destroy()
		end
	end
end)

Note: There are no errors in the output.

1 Like

If its welded to the humanoid root part and the bees have Mass It will make the player move weird. I recommend making all the bees Massless.

2 Likes

I just did that and the player stopped moving in a weird way but the bees are still far away from the player. How can I fix that

1 Like

When it comes to a WeldConstraint you need to set the bee’s CFrame before welding them. It won’t act like a Weld remember.

Edit :
If you don’t set any CFrame the bees will just be in there default position and move with the player just like what’s happening in your case.

1 Like

I replaced the Weld Constraint with a Weld for the Main Part and the HumanoidRootPart and it worked perfectly fine!

1 Like

Awesome!! It looks like Weld was better for you in that case, Nice job mate :+1: .

1 Like