Current Script
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local camera = game.Workspace.CurrentCamera
local hold = false
local currentposition = {}
mouse.Button1Down:Connect(function()
if hold == false then
currentposition = {mouse.X/script.Parent.AbsoluteSize.X,mouse.Y/script.Parent.AbsoluteSize.Y}
hold = true
script.Parent.Highlight.Position = UDim2.fromScale(currentposition[1],currentposition[2])
local con
con = game:GetService("RunService").RenderStepped:Connect(function(delta)
script.Parent.Highlight.Size = UDim2.fromScale((mouse.X/script.Parent.AbsoluteSize.X)-currentposition[1],(mouse.Y/script.Parent.AbsoluteSize.Y)-currentposition[2])
if script.Parent.Highlight.Visible == false then
task.wait()
script.Parent.Highlight.Visible = true
end
if hold == false then
script.Parent.Highlight.Size = UDim2.fromScale(0,0)
script.Parent.Highlight.Visible = false
con:Disconnect()
end
end)
end
end)
mouse.Button1Up:Connect(function()
if hold == true then
currentposition = {0,0}
hold = false
wait()
script.Parent.Highlight.Size = UDim2.fromScale(0,0)
script.Parent.Highlight.Visible = false
end
end)
What i am trying to achieve is to make the 2d view to turning into a 3d object with 2 points that creates a block that has a region3 script to find out what is in the 3d object