I just want to move the mouse position to my custom made cursor.
Code:
--Xbox stuff
local CursorEnabled = false --The crosshair cursor thing you see
local UserInputService = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
UserInputService.InputBegan:Connect(function(key)
if UserInputService.GamepadEnabled then
if key.KeyCode == Enum.KeyCode.ButtonX then
CursorEnabled = not CursorEnabled
print(CursorEnabled)
end
end
end)
UserInputService.InputChanged:Connect(function(key)
if UserInputService.GamepadEnabled then
if CursorEnabled and key.KeyCode == Enum.KeyCode.Thumbstick1 then
script.Parent.Cursor.Position += UDim2.new(0, key.Position.X * 5, 0, -key.Position.Y * 5)
--for index, ui in pairs(script.Parent:GetDescendants()) do
-- if ui:IsA("GuiObject") then
-- if math.abs(ui.Position.X.Offset - script.Parent.Cursor.Position.X.Offset) <= 5 then
-- GuiService.SelectedObject = ui
-- elseif math.abs(ui.Position.Y.Offset - script.Parent.Cursor.Position.Y.Offset) <= 5 then
-- GuiService.SelectedObject = ui
-- else
-- GuiService.SelectedObject = nil
-- end
-- end
--end
end
end
end)