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

Why is my gui movement script not making the sprite move?

I'm making a game with a gui character (currently just using a black image instead of a sprite btw) but I cant make it move I tried to just use an expression but that didnt work.

heres my code:

if game.Players.LocalPlayer.PlayerGui.mainGui.controlFrame.room.Visible == true then
img.Position = img.Position - 0.100

2 answers

You're missing an end of input. The following might help.

if game.Players.LocalPlayer.PlayerGui.mainGui.controlFrame.room.Visible == true then
    img.Position = img.Position - 0.100
end

1 comment

0

^ Forgot to mention that img isn't defined.

You have to loop it or something if you want it to keep moving but guis use UDim2's to move around so you'd have to do something like this

if game.Players.LocalPlayer.PlayerGui.mainGui.controlFrame.room.Visible == true then
    img.Position = img.Position - UDim2.new(0.100, 0, 0 ,0) --X scale, X offset, Y scale, Y offset
end

Also i recommend you learn some tweening because those are smooth

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