Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Getting a mini map to display roads correctly help?

Asked by
NotSoNorm 777 Moderation Voter
9 years ago

What I'm trying to do: http://prntscr.com/98cabo

When I run this script to make the mini map, the roads are really small and are not connected at all: http://prntscr.com/98caws

--local roads = game.Workspace.Roads
local mapDistance = 200

--Raycast to local roads

while wait(5) do
    local characterPosition = game.Players.LocalPlayer.Character.Torso.Position

    local p1 = Vector3.new(characterPosition.X-mapDistance/2,characterPosition.Y-mapDistance/2,characterPosition.Z-mapDistance/2)
    local p2 = Vector3.new(characterPosition.X+mapDistance/2,characterPosition.Y+mapDistance/2,characterPosition.Z+mapDistance/2)

    local region = Region3.new(p1, p2) --Draw giant box around character

    --DrawBox
    local prt = Instance.new("Part",game.Workspace)
        prt.Anchored = true
        prt.CanCollide = false
        prt.Transparency = .5
        prt.Size = Vector3.new(region.Size)
        prt.CFrame = region.CFrame

    for i,v in pairs(script.Parent.MiniHud.ActualRotateMap:GetChildren()) do
        v:Destroy() --Destroy old map peices
    end

    for _, part in pairs(game.Workspace:FindPartsInRegion3(region,nil, 100)) do
        if part.Name == "Road" or part.Name == "Intersection" then --Make sure it's a road
            local guiObj = script.Bar:Clone() --Create new map peices
                guiObj.Parent = script.Parent.MiniHud.ActualRotateMap
                guiObj.Rotation = part.Rotation.Y
                guiObj.Size = UDim2.new(part.Size.X/region.Size.X,0,part.Size.Y/region.Size.Y,0)
                guiObj.Position = UDim2.new(part.Position.X/region.CFrame.X,0,part.Position.Y/region.CFrame.Y,0)
                guiObj.BackgroundColor3 = Color3.new(part.BrickColor.Color.r/255,part.BrickColor.Color.g/255,part.BrickColor.Color.b/255)
        end
    end
    prt:Destroy()
end

Answer this question