At the moment I am trying to make a game that will have a building mechanic that resembles Minecraft. I am trying to make it outline a part when the player hovers there mouse over it but I cannot seem to figure out how. Here is my current code.
local Player = game:GetService("Players").LocalPlayer local Mouse = Player:GetMouse() while true do if Mouse.Target then local blockTest = Mouse.Target:FindFirstChild("SelectionBox") if blockTest then blockTest.Transparency = 0 end end wait(0.01) end
Might not work online but heres a working example for you to work apon.
You may need to control the selectionbox through a server script and hook it up with remote functions for other people/players to see the selection box!.
Code (Local Script):
local Player = game:GetService("Players").LocalPlayer local Mouse = Player:GetMouse() local SelectionBox = Instance.new("SelectionBox",script) while true do if Mouse.Target ~= nil then SelectionBox.Adornee = Mouse.Target SelectionBox.Parent = Mouse.Target else SelectionBox.Adornee = nil SelectionBox.Parent = script end wait(0.01) end