Hello, I’ve been trying to figure out how to make a frame change size depending on other frame’s position. Example of what is happening: example. However, I want the red bar to always follow the dot.
I’ve already got a script for dragging the dot.
Code:
-- // Locals
UIS = game:GetService("UserInputService")
local MouseInputEnum = Enum.UserInputType.MouseButton1
Dragging = false
script.Parent.Dot.MouseButton1Down:Connect(function()
Dragging = true
end)
-- // Started
UIS.InputChanged:Connect(function()
if Dragging then
local MousePos = UIS:GetMouseLocation()+Vector2.new(0,36)
local RelPos = MousePos-script.Parent.AbsolutePosition
local Precent = math.clamp(RelPos.X/script.Parent.AbsoluteSize.X,0,1)
script.Parent.Dot.Position = UDim2.new(Precent,0,0.5,0)
end
end)
-- // Ended
UIS.InputEnded:Connect(function(input)
if input.UserInputType == MouseInputEnum then
Dragging = false
end
end)
Any help is appracticated.