How to make Select box?

I would like to make something like in this game. I already made ctrl+click to print part and i wanna add like this select box. I’m trying to make some building scripts in game

local Plr = game:GetService("Players").LocalPlayer
local Mouse = Plr:GetMouse()

Mouse.Button1Down:connect(function()
if not game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.LeftControl) then return end
if not Mouse.Target then return end
print(Mouse.Target:GetFullName())
end)

1 Like

You can use a SelectionBox and set the Adornee property to achieve this.

local Plr = game:GetService("Players").LocalPlayer
local Mouse = Plr:GetMouse()

Mouse.Button1Down:connect(function()
	local target = Mouse.Target
	if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.LeftControl) and target then
		print(target:GetFullName())
		local selectionBox = Instance.new("SelectionBox")
		selectionBox.Parent = target
		selectionBox.Adornee = target
	end
end)
1 Like

Or u can use Hilight

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.