I have an issue for the past forty-five minutes or so and I’ve found nothing. This reoccuring issue is when I manage to change the specific position of my hat. it’ll reset the rotation to (0, 0, 0). If this doesn’t make sense I’ll try my best to replicate it on the video below:
Local Script
AdornmentHandles.MouseDrag:Connect(function(a, b)
HatHandle.AccessoryWeld.Enabled = false
HatHandle.Anchored = true
if a.Value == 5 then
HatHandle.CFrame = origin + HatHandle.CFrame.LookVector * math.round(b/GridSize.Value)*GridSize.Value
elseif a.Value == 2 then
HatHandle.CFrame = origin + HatHandle.CFrame.LookVector * -math.round(b/GridSize.Value)*GridSize.Value
elseif a.Value == 1 then
HatHandle.CFrame = origin + HatHandle.CFrame.UpVector * math.round(b/GridSize.Value)*GridSize.Value
elseif a.Value == 4 then
HatHandle.CFrame = origin + HatHandle.CFrame.UpVector * -math.round(b/GridSize.Value)*GridSize.Value
elseif a.Value == 0 then
HatHandle.CFrame = origin + HatHandle.CFrame.RightVector * math.round(b/GridSize.Value)*GridSize.Value
elseif a.Value == 3 then
HatHandle.CFrame = origin + HatHandle.CFrame.RightVector * -math.round(b/GridSize.Value)*GridSize.Value
end
end)
AdornmentHandles.MouseButton1Up:Connect(function()
HatHandle.AccessoryWeld.Enabled = false
HatHandle.Anchored = false
origin = HatHandle.CFrame
local HatHandleCurrentPos = HatHandle.CFrame.Position
ReplicatedStorage.Customization.PositionCheck:FireServer(origin, Hat, HatHandleCurrentPos)
end)
Serverscript
EventsFolder.PositionCheck.OnServerEvent:Connect(function(Player, origin, Hat, HatHandleCurrentPos)
local Accessory = Player.Character:FindFirstChild(Hat.Name)
local Handle = Accessory.Handle
Handle.AccessoryWeld.Enabled = false
Handle.CFrame = CFrame.new(HatHandleCurrentPos)
if Handle:FindFirstChild("WeldConstraint") == nil then
local NewWeldConstraint = Instance.new("WeldConstraint")
NewWeldConstraint.Part0 = Handle
NewWeldConstraint.Part1 = Player.Character.Head
NewWeldConstraint.Parent = Handle
end
end)
