I’m trying to show a semi-transparent GUI when inside a block,and make it invisible when outside. I’ve tried using Magnitude and also using Region3, but the magnitude is getting the center of the block and isn’t accurate.
Script I tried:
local rs = game:GetService("RunService")
local plr = game.Players.LocalPlayer
local char = plr.Character
rs.RenderStepped:Connect(function()
if char then
local posCompare1 = (char:WaitForChild("HumanoidRootPart").Position - workspace:WaitForChild("Storm"):WaitForChild("Side1").Position).Magnitude
local posCompare2 = (char:WaitForChild("HumanoidRootPart").Position - workspace:WaitForChild("Storm"):WaitForChild("Side2").Position).Magnitude
local posCompare3 = (char:WaitForChild("HumanoidRootPart").Position - workspace:WaitForChild("Storm"):WaitForChild("Side3").Position).Magnitude
local posCompare4 = (char:WaitForChild("HumanoidRootPart").Position - workspace:WaitForChild("Storm"):WaitForChild("Side4").Position).Magnitude
print(posCompare1)
if posCompare1 <= 3 or posCompare2 <= 3 or posCompare3 <= 3 or posCompare4 <= 3 then
script.Parent.Visible = true
else
script.Parent.Visible = false
end
end
end)
I’m not sure if there is an easier way to show a color while inside a block. If there is that’d be great.