UIS.InputChanged:Connect(function()
if ClickedOn then
local X = Mouse.X - ClickedOn.X
local Y = Mouse.Y - ClickedOn.Y
if X < 0 then
SelectionBox.Position = UDim2.fromOffset(ClickedOn.X + X, ClickedOn.Y)
X = math.abs(X)
end
if Y < 0 then
SelectionBox.Position = UDim2.fromOffset(ClickedOn.X, ClickedOn.Y + Y)
Y = math.abs(X)
end
SelectionBox.Size = UDim2.fromOffset(X, Y)
SelectionBox.Visible = true
end
end)
Bugs on the right side of the screen. For somereason it scales up when you move and isnt like the left side which is the desired behavior. The desired behavior is like in other rts games such as a normal rts or tc3. Where it scales to your mouse
I’m not too familiar with this kind of thing, but in your first section of code you are just dealing with the X position but in the second section of code you have if Y < 0, then you do Y = math.abs(X)
Basically I’m looking for the largest X and Y combination and subracting the smallest X and Y combination, I think that was the issue with your code, although I never tested anything.