local Players = game:GetService("Players") local RunService = game:GetService("RunService") local TextChatService = game:GetService("TextChatService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Workspace = game:GetService("Workspace") local localPlayer = Players.LocalPlayer local CHAT_COMMAND = "-net" local ZERO_WEIGHT_PHYSICS = PhysicalProperties.new(0.0001, 0, 0, 0, 0) local function sendInstantNet() task.spawn(function() if TextChatService.ChatVersion == Enum.ChatVersion.TextChatService then local textChannels = TextChatService:WaitForChild("TextChannels", 3) local generalChannel = textChannels and textChannels:FindFirstChild("RBXGeneral") if generalChannel then pcall(function() generalChannel:SendAsync(CHAT_COMMAND) end) return end end local chatEvents = ReplicatedStorage:FindFirstChild("DefaultChatSystemChatEvents") if chatEvents then local sayRequest = chatEvents:FindFirstChild("SayMessageRequest") if sayRequest and sayRequest:IsA("RemoteEvent") then pcall(function() sayRequest:FireServer(CHAT_COMMAND, "All") end) return end end end) end sendInstantNet() local activeConnections = {} local function clearConnections() for _, conn in ipairs(activeConnections) do if conn and typeof(conn) == "RBXScriptConnection" then conn:Disconnect() end end table.clear(activeConnections) end local function applyLockedHairSystem(character) clearConnections() local humanoid = character:WaitForChild("Humanoid", 10) local realHead = character:WaitForChild("Head", 10) if not humanoid or not realHead then warn("[HairLock] Testa o Humanoid non rilevati in tempo.") return end task.wait(0.2) local detectedHairs = {} local headHairAttachment = realHead:FindFirstChild("HairAttachment") or realHead:FindFirstChild("HatAttachment") for _, item in ipairs(character:GetChildren()) do if item:IsA("Accessory") then local handle = item:FindFirstChild("Handle") if handle then local isHairType = false if item.AccessoryType == Enum.AccessoryType.Hair then isHairType = true end local hairAttachment = handle:FindFirstChild("HairAttachment") local hatAttachment = handle:FindFirstChild("HatAttachment") if isHairType or hairAttachment or hatAttachment then handle.Massless = true handle.CanCollide = false handle.CanTouch = false handle.CanQuery = false handle.Anchored = false handle.CustomPhysicalProperties = ZERO_WEIGHT_PHYSICS local chosenAttachment = hairAttachment or hatAttachment local relativeOffset = CFrame.new(0, 0.6, 0) if headHairAttachment and chosenAttachment then relativeOffset = headHairAttachment.CFrame * chosenAttachment.CFrame:Inverse() end table.insert(detectedHairs, { accessory = item, handle = handle, offset = relativeOffset }) local ancestryConn = item.AncestryChanged:Connect(function(_, newParent) if newParent ~= character and character.Parent then task.defer(function() item.Parent = character handle.Parent = item handle.Anchored = false end) end end) table.insert(activeConnections, ancestryConn) end end end end if #detectedHairs == 0 then warn("[HairLock] Nessun accessorio per capelli trovato sul personaggio.") return end local function getActiveHead() for _, model in ipairs(Workspace:GetChildren()) do if model:IsA("Model") and model ~= character and model:FindFirstChild("Head") and model:FindFirstChild("Humanoid") then if string.find(model.Name, localPlayer.Name) or model.Name == "CatwareRig" or model.Name == "Dummy" then return model.Head end end end return realHead end local renderConn = RunService.RenderStepped:Connect(function() local targetHead = getActiveHead() if not targetHead or not targetHead.Parent then return end for _, hairData in ipairs(detectedHairs) do local handle = hairData.handle if handle and handle.Parent then handle.CFrame = targetHead.CFrame * hairData.offset if handle.Transparency > 0 then handle.Transparency = 0 end if handle.LocalTransparencyModifier > 0 then handle.LocalTransparencyModifier = 0 end end end end) table.insert(activeConnections, renderConn) local stepConn = RunService.Stepped:Connect(function() local targetHead = getActiveHead() if not targetHead or not targetHead.Parent then return end for _, hairData in ipairs(detectedHairs) do local handle = hairData.handle if handle and handle.Parent then if handle.Anchored then handle.Anchored = false end if handle.CanCollide then handle.CanCollide = false end handle.CFrame = targetHead.CFrame * hairData.offset handle.AssemblyLinearVelocity = targetHead.AssemblyLinearVelocity handle.AssemblyAngularVelocity = targetHead.AssemblyAngularVelocity end end end) table.insert(activeConnections, stepConn) end if localPlayer.Character then task.spawn(applyLockedHairSystem, localPlayer.Character) end localPlayer.CharacterAdded:Connect(function(newCharacter) sendInstantNet() task.spawn(applyLockedHairSystem, newCharacter) end)