Can anyone tell me why my inputPosition is broken?

Game file:
broken inputPosition.rbxl (63.8 KB)

Video file of what’s happening:

Thanks!

1 Like

Can you provide the code? --wordlimit–

Well I purposely made the game as simple and barebones as I could, but sure, here ya go :D

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")

local dragDetectorTable = {}

for _, button:TextButton in script.Parent.PartButtonsBar:GetChildren() do
	
	table.insert(dragDetectorTable, button:FindFirstChildOfClass("UIDragDetector"))
	
end

-- -- -- -- --

for _, uiDragDetector:UIDragDetector in pairs(dragDetectorTable) do

	uiDragDetector.DragStart:Connect(function(inputPosition)
		
		local frame = Instance.new("Frame")
		frame.Size = UDim2.fromOffset(3,3)
		frame.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
		frame.Parent = script.Parent.Parent
		frame.Position = UDim2.fromOffset(inputPosition.X,inputPosition.Y)	

	end)

end
Mouse = game.Players.LocalPlayer:GetMouse()
function MouseIsInFrame(frame)
	local mouseX, mouseY = Mouse.X, Mouse.Y
	local framePos = frame.AbsolutePosition
	local frameEnd = framePos + frame.AbsoluteSize
	return mouseX >= framePos.x and mouseX <= frameEnd.x and mouseY >= framePos.y and mouseY <= frameEnd.y
end

you could try using this function

that works, but it doesn’t explain why it’s broken… do you have an explanation?

I’m unsure… I apologize --wordlimit–

no worries :hugs:

I did some tests, and I guess that has to do with the top safe area for roblox icons

setting the screenGui IngoreGuiInset to true should solve the issue
image

1 Like

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