Help solving Handles Visual Glitch

Hello. I am working on a game that uses the Roblox Handles Instance. There is a visual bug where the small square part of the dots stay on the same place of your screen when your camera moves. How can I fix this?

image

1 Like

Could you show us the code please?

1 Like
local handle = script.Parent
local oldDelta = 0
local snap = .75/4
local smallestSize = .75/4

local new
local new2

local surfaceAxis = {
	[Enum.NormalId.Top] = 'Y',
	[Enum.NormalId.Bottom] = 'Y',
	[Enum.NormalId.Front] = 'Z',
	[Enum.NormalId.Back] = 'Z',
	[Enum.NormalId.Left] = 'X',
	[Enum.NormalId.Right] = 'X'
}

script.Parent.Parent.BuildFrame:GetPropertyChangedSignal("Visible"):Connect(function()
	if script.Parent.Parent.BuildFrame.Visible == false then
		script.Parent.Adornee = nil
		script.Parent.Visible = false
	end
end)
handle.MouseDrag:Connect(function(face, distance)
	local delta = distance - oldDelta
	
	
	if not new then
		new = Instance.new("Attachment",script.Parent.Adornee)
		
		
		new2 = game.ReplicatedStorage.Content.Gui.SizeIndicator:Clone()
		new2.Parent = new
		
		new2.TextLabel.Text = string.sub(script.Parent.Adornee.Size[surfaceAxis[face]]/3,1,3)
	else
		--new.Position = script.Parent.Adornee.Size[surfaceAxis[face]]/2
		new2.TextLabel.Text = string.sub(script.Parent.Adornee.Size[surfaceAxis[face]]/3,1,3)
		
	end
	
	
	

	if math.abs(delta * 1.125) >= snap then
		delta = math.round(delta / snap) * snap

		local direction = Vector3.fromNormalId(face)
		local size = Vector3.new(math.abs(direction.X), math.abs(direction.Y), math.abs(direction.Z))
		local endSize = handle.Adornee.Size + size * delta

		if endSize[surfaceAxis[face]] > smallestSize and endSize[surfaceAxis[face]] < 30 then
			handle.Adornee.Size = endSize
			handle.Adornee:PivotTo(handle.Adornee.CFrame * CFrame.new(direction / 2 * delta))
			oldDelta = distance
	
		end
	end
end)

handle.MouseButton1Up:Connect(function()
	if new then
		new:Destroy()
		new = nil
		new2 = nil
	end
	oldDelta = 0
	
	game.SoundService.SoundEffects.Click2:Play()
	game.ReplicatedStorage.Events.BuildMode.ChangeBlockSize:FireServer(handle.Adornee,handle.Adornee.Size,handle.Adornee.CFrame)
end)

Okay, sorry, I’m not able to completely understand the Script, but are you updating the position of the handles? If not than that’s the problem, if yes then I honestly don’t know, I’m sorry I’m not a Programmer

I’m sorry. There is code that’s affecting the handles. The problem might happen when the handle adornee is changing in position and size.

1 Like

Okay. The problem is happening when the handles are being interacted with. (And when the adornee of it changes size or position)

1 Like

I was able to reproduce the issue after parenting the handle instance to a BillboardGui/SurfaceGui. Setting the handle’s parent to StarterGui seems to fix the problem.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.