Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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?

4 comments

0

You need to use the udim2.start() for fix that

0

why would you just to plus the Position and UDim2, just why

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.

0

just checked the roblox dev site for udim2, there's no such thing as "udim2.start()"

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.