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

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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
0
^ Forgot to mention that img isn't defined. ItzTacoTimee 6 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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

Answer this question