Translating a position from the client to the serverside issue

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)

Have you tried sending the orientation/rotation as well to set that also, I would just print the orientation before you Fireserver then in the OnserverEvent just to help debugging so you can understand where and when its going wrong

I haven’t yet, but I’ll take this into account right now and test it out and see what I can do.

1 Like


this is appearing to what I am receiving, the first 3 numbers are the X, Y, Z.
it returns 0, only after I reposition it. Im assuming this error is around in my serverside script when I put a weldconstraint.

however, this weld constraint is needed as if I just use the normal roblox “AccessoryWeld” it’ll just return the accessory back to the original position it was, so this is what really has me lost.

(bump I still need help)

1 Like