What do you want to achieve?
I want my script to run, it confused me for a while.
What is the issue? Include screenshots / videos if possible!
alrighty so my issue is in my radargui, I have a localscript inside the gui but it only runs the first 6 lines! when I remove the lines it runs the rest of the script but I need the variables for it to not error.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have put prints everywhere in my code to see where the issue lied, line 8 and below are void, not running at all.
local player = game.Players.LocalPlayer
local character = player.CharacterAdded:wait()
local root = character:WaitForChild("HumanoidRootPart")
local main = script.Parent:WaitForChild("Main")
local area = 200
local maxParts = 100
print("This print doesnt run.") -- this print doesnt run, the lines above it cause some issue but idk.
function buildMap()
main:ClearAllChildren()
local region = Region3.new(root.CFrame.p-Vector3.new(area,10,area),root.CFrame.p+Vector3.new(area,10,area))
local parts = workspace:FindPartsInRegion3WithIgnoreList(region,{character},maxParts)
for _,v in pairs(parts) do
local part = Instance.new("Frame",main)
part.Size = UDim2.new(0,v.Size.X,0,v.Size.Z)
part.BackgroundColor3 = v.Color
local CF = CFrame.new(root.CFrame.p)
local pos = CF:toObjectSpace(v.CFrame)
local realPos = CFrame.new(pos.X+(main.Size.X.Offset/2),0,pos.Z+(main.Size.Y.Offset/2))
part.Position = UDim2.new(0,realPos.X-part.Size.X.Offset/2,0,realPos.Z-part.Size.Y.Offset/2)
part.ZIndex = v.Position.Y
end
end
game:GetService("RunService").RenderStepped:connect(function()
buildMap()
end)