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

UDim2 is moving an invisible duplicate of a frame / object?

Asked by
x_Tso 48
5 years ago

So I'm trying to make a simple script that moves a GUI (representing a player icon) a certain distance as long as a key is being held. While W is held, it moves up x pixels every y seconds, etc. That's all fine, and the script itself is working, but when I test in Studio or in-game, it seems to be moving an 'invisible' version of the frame. What I mean is, the frame doesn't appear to be moving in the test window (it's staying exactly still) but when I select the frame in the explorer, an invisible version of the frame is highlighted in the correct position.

The line in the script that moves the frame is below:

game.StarterGui.Main_Game.Player.Icon.Position = Icon.Position +YUp

In this case, 'YUp' is defined below:

local YUp = UDim2.new(0, 0, 0, -1)

And this script works on the 'ghost' version of the frame, but I need it to work on the actual frame. I want it to visibly move, not move a ghost copy that you can't see unless you select it in the explorer. Any ideas, or is this a bug?

0
You need to use the udim2.start() for fix that shinferno -53 — 5y
0
why would you just to plus the Position and UDim2, just why cherrythetree 130 — 5y
0
plus udim2 because it's not changing it to a set position but it's moving the position by the udim2 value. remember, i'm trying to move an icon on the screen with wasd keys. if i just did udim, it'd set it the udim position and it'd stay there. x_Tso 48 — 5y
0
just checked the roblox dev site for udim2, there's no such thing as "udim2.start()" x_Tso 48 — 5y

1 answer

Log in to vote
0
Answered by
x_Tso 48
5 years ago

solution: there is no such thing as a udim2.Start(), I apparently didn't know what PlayerGui was. if you're moving guis on a local basis, you must must must use PlayerGui, not StarterGui.

it's a clone of StarterGui held locally on each player. access in a localscript by "game.Players.LocalPlayer.PlayerGui"

everything is held in the same guis folders and position as in StarterGui, just held locally.

Ad

Answer this question