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.