Hi, I didn’t know what to write for the title, so I just wrote help with scripting, Anyways I wanna do something like whenever I point my house at something it does something like this:
Help is appreciated!
Hi, I didn’t know what to write for the title, so I just wrote help with scripting, Anyways I wanna do something like whenever I point my house at something it does something like this:
Are you talking about the green thing? That’s a SelectionBox. You can set its Adornee to a BasePart or Model to create this box around it. If you’re looking for other kinds of help, then you should try looking around the Developer Hub for some content that may help you here. There’s no detailed question to be answered so equally can’t point you in any directions here.
So I’d have to create my own Selection Box?
You can insert a selection box into the part/object, and set the Adornee to the parent, then it will give a selection around the part like the image you have shown. After you can change colours etc.
Oh, I didn’t know you could instance the selection box doing Instance.new("SelectionBox", parent)
You can do it via studio as well, but if you do it via instance you would have to set the ardornee as well, and possibly colours which may be annoying. You can just insert it in studio, if you want to disable it change Visible to false.
What I want to do is, whenever your mouse enters a part, it’s gonna insert a selection box
Just another thing, if you’re creating an instance, you shouldn’t parent the instance in the same line.
Starter code on how to do object highlighting in a local script.
local selection = Instance.new(“SelectionBox”)
local currentAdornee -- is nil
local function mouseMoved(target) -- target may be nil or a part
-- prevent changing selection if target is same as currently selected
if currentAdornee == target then return end -- guard clause, search on devforum if you don’t know what that means
currentAdornee = target
selection.Adornee, selection.Parent = target, target -- sets both properties to target
end