OK wait a sec
You can also see the app on the bottom right it is meant to stay in the screen and not further and here:
Still here, just thinking why it would teleport the the bottom right
UDim2.new((game.Players.LocalPlayer:GetMouse().X / game.Players.LocalPlayer:GetMouse().ViewSizeX)-frame.Size.X.Scale/2,0,(game.Players.LocalPlayer:GetMouse().Y / game.Players.LocalPlayer:GetMouse().ViewSizeY)-frame.Size.Y.Scale/1.25,0)
This is code I’ve used in the past to drag, but I’m not sure whether the issue is down to a property of the GUI or the code itself, try this and see if anything changes. Replace frame with the gui that you want by the way
Now it moves up to the right a little bit look:
the issue must be something to do with the properties of the gui
make sure everything is default
I will send all props:
properties for RoPainter gui object
Wrong one oops
Sorry just noticed that lol
Alr last resort, can I get a download of the gui and the script you’re using to test myself and try and find the error
frame.Position = UDim2.new(0,Mouse.X - (workspace.CurrentCamera.ViewportSize.X * 0.1375),0,Mouse.Y + (workspace.CurrentCamera.ViewportSize.Y * 0.18))
This worked for me in studio, should work for you. Set the AnchorPoint of the “RoPainter” GUI to 0.5, 0.5 and it should be set.
I will test in a sec hold on
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
local UserInputService = game:GetService('UserInputService')
local hold = false
function inputBegan(input)
local inputType = input.UserInputType
if inputType == Enum.UserInputType.MouseButton1 then
hold = true
end
end
function inputEnded(input)
local inputType = input.UserInputType
if inputType == Enum.UserInputType.MouseButton1 then
hold = false
end
end
UserInputService.InputBegan:Connect(inputBegan)
UserInputService.InputEnded:Connect(inputEnded)
game:GetService("RunService").RenderStepped:Connect(function()
if hold then
if Mouse then
local x, y = Mouse.X, Mouse.Y
script.Parent.Parent.Position = UDim2.new(0,x,0,y)
end
end
end)
local UIS = game:GetService("UserInputService")
local function dragify(Frame)
local startPos = Frame.Position or nil
dragToggle = nil
local dragSpeed = 0.50 --- or modify the drag speed you want it to be.
dragInput = nil
dragStart = nil
local dragPos = nil
function updateInput(input)
local Delta = input.Position - dragStart
local Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + Delta.X, startPos.Y.Scale, startPos.Y.Offset + Delta.Y)
game:GetService("TweenService"):Create(Frame, TweenInfo.new(0.30), {Position = Position}):Play()
end
Frame.InputBegan:Connect(function(input)
if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and UIS:GetFocusedTextBox() == nil then
dragToggle = true
dragStart = input.Position
startPos = Frame.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragToggle = false
end
end)
end
end)
Frame.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
dragInput = input
end
end)
game:GetService("UserInputService").InputChanged:Connect(function(input)
if input == dragInput and dragToggle then
updateInput(input)
end
end)
end
local frame = script.Parent
dragify(frame)
This will make your frame dragify smoothly.
Frame.Active = true
Frame.Draggable = true
Draggable is deprecated but may work for you
And I’m pretty sure there’s some modules that might be more useful
Also if you wanna use your own code make sure to use loops and break the loop when the mouse leaves
Maybe it’s because it’s using scale instead of offset when changing the position of the gui? Would the mouse position use scale or offset?