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

GUI placement help?

Asked by 10 years ago

I'm trying to generate a minimap GUI for a map, but my script isn't working (and I'm not sure why). All of the walls in my map are in one model, so the script creates a frame for each wall, sizes it, and places it where it should go on the minimap.

for i,v in pairs(game.Workspace.Map1.Walls:GetChildren()) do
local frame = game.StarterGui.WallFrame:Clone()
frame.Parent = game.StarterGui.ScreenGui.MinimapFrame

local xSize = v.Size.X
local zSize = v.Size.Z
local xPos = v.Position.X
local zPos = v.Position.Z
local rot = v.Rotation.Y
d = 2

frame.Size = UDim2.new(0, xSize/2, 0, zSize)
frame.Position = UDim2.new(0, xPos/d + 100 - xSize/2, 0, zPos/d + 100 - zSize)
frame.Rotation = rot
end

For whatever reason this is what is coming up: http://i.imgur.com/MvfKG5c.png And this is not quite what the map looks like (the problem seems to be mostly with the big walls, but I'd like to get the rest of the walls looking like they should).

0
Make sure there are no invisible parts in the Map1 Walls model, as that will display on the Gui. I suggest creating a conditional statement, only adding parts to the Gui if a part is not completely transparent. SlickPwner 534 — 10y
0
There aren't any invisible parts. My problem is that the GUIs are not being placed properly, even though I'm setting their X/Z UDim2 positions to their X/Z Vector3 positions (or the equivalent of that). MightyWanderer 30 — 10y
0
Just an FYI - UDim2's do not HAVE a Z coordinate. Only X and Y. However, I do understand that you're just using Z as a way to keep track of it...But for anyone reading this, please know that UDim2's do not TECHNICALLY have a Z coordinate. NoahWillCode 370 — 10y

Answer this question