#EYE GUI Mouse Drag D-pad

9 messages · Page 1 of 1 (latest)

keen epoch
#

Here's The Button Layout and

Heres part of the script for the look up button

local up = Instance.new('ImageButton', FaceBase) up.Size = UDim2.new(0.333, 0, 0.334, 0) up.Position = UDim2.new(0.334, 0, 0, 0) up.ZIndex = 2 up.BackgroundTransparency = 1 up.Image = 'rbxassetid://0' up.MouseButton1Click:Connect(function() EyePupils.Position = UDim2.new(0, 0, -0.05, 0) eye1.Transparency = 1 eye2.Transparency = 1 eye3.Transparency = 1 eye4.Transparency = 1 eye5.Transparency = 1 eye6.Transparency = 1 eye7.Transparency = 1 eye8.Transparency = 1 eye9.Transparency = 0 end)

sturdy pumice
#

You can use inputchanged

#

Example :

local UserInputService = game:GetService("UserInputService")

local up = Instance.new('ImageButton', FaceBase)
up.Size = UDim2.new(0.333, 0, 0.334, 0)
up.Position = UDim2.new(0.334, 0, 0, 0)
up.ZIndex = 2
up.BackgroundTransparency = 1
up.Image = 'rbxassetid://0'

local dragging = false

-- Function to update eye position based on mouse movement
local function updateEyePosition(input)
local delta = input.Position - up.AbsolutePosition
local newX = math.clamp(delta.X / up.AbsoluteSize.X, 0, 1)
local newY = math.clamp(delta.Y / up.AbsoluteSize.Y, 0, 1)
EyePupils.Position = UDim2.new(newX, 0, newY, 0)
end

up.MouseButton1Down:Connect(function()
dragging = true
EyePupils.Position = UDim2.new(0, 0, -0.05, 0)
eye1.Transparency = 1
eye2.Transparency = 1
eye3.Transparency = 1
eye4.Transparency = 1
eye5.Transparency = 1
eye6.Transparency = 1
eye7.Transparency = 1
eye8.Transparency = 1
eye9.Transparency = 0
end)

up.MouseButton1Up:Connect(function()
dragging = false
end)

UserInputService.InputChanged:Connect(function(input)
if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
updateEyePosition(input)
end
end)

#

The script is probably bad but it’s to show a little

keen epoch
sturdy pumice
#

InputChanged event in conjunction with the MouseButton1Down and MouseButton1Up events

keen epoch
sturdy pumice
#

Else use parts with clickdetector