How to use Selection Service? (For a beginner)

Hello! I’m a noob when it comes to Selection Service, I don’t understand it much, but this is what I’m trying to do. Basically I want to create a code where when you click a button (In a plugin), whatever UI you’ve selected will be changed in its position and size.

	ResizeWholeScreenButton.MouseButton1Click:Connect(function()
			ClickSound()
			local Selection = game:GetService("Selection")
			local Current = Selection:Get()
			print(Current.Parent)
			--Current.Position = UDim2.new(-0.003, 0,-0, 0)
			--Current.Size = UDim.new(1.053, 0,1, 0)
		end)

I’m not sure how to properly set it up

image

Here is the button in my plugin, once you click it,

image

Im trying to make it resize it as provided above, thanks :smiley:

1 Like

Simple mistake

Selection:Get() --ex: {Part, Wedge, Model}

return a list
You could use a for loop

local Selection = game:GetService("Selection")
local Current = Selection:Get()
for _,Instance in pairs(Current) do
	Instance.Position = UDim2.new(-0.003, 0,-0, 0)
	Instance.Size = UDim.new(1.053, 0,1, 0)
end
2 Likes