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

Moving gui across screen? SOLVED!

Asked by
FiredDusk 1466 Moderation Voter
9 years ago

The script below makes a gui go from left to right. So I make this gui start from the right side of the screen and it goes to the left. Whenever it goes to the left, the gui just disappears. I want whenever it disappears from the left side of the screen, I want it to appear back on the right side of the screen and repeat.

while true do
    script.Parent.Position=script.Parent.Position-UDim2.new(0.005,0,0,0)-- "-" makes it go from right to left
    wait()
end

2 answers

Log in to vote
2
Answered by
dyler3 1510 Moderation Voter
9 years ago

Updated

Try this:

Startposition=script.Parent.Position

while true do
    local RightBorder=script.Parent.AbsolutePosition.X+script.Parent.AbsoluteSize.X
    if RightBorder<=0 then
        script.Parent.Position=Startposition
    else
        script.Parent.Position=script.Parent.Position-UDim2.new(0.005,0,0,0)
    end
    wait()
end

Anyways, this should work correctly now. If not, or if you have any further questions, please leave a comment below. Hope I helped :P

0
Thank you, it works when it hits the side of the screen but it changes the position. How do I make it as the same position as it is before? FiredDusk 1466 — 9y
0
Oh, i'll adjust it to do that, hold on a min :P dyler3 1510 — 9y
0
Fixed it. I think that's what you meant. dyler3 1510 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

You didnt use TweenPosition!

(note pick a position to start at(no script) then pick where you want it to move)

while true do
        script.Parent:TweenPosition(UDim2.new(number, number, number, number), "Out", "Quad", number, true or false) -- quad and out are just the default or something like that
    wait(number)
script.Parent:TweenPosition(UDim2.new(original pos., original pos., original pos., original pos.), "Out", "Quad", number, true or false) 
end

For more info visit this http://wiki.roblox.com/index.php?title=TweenPosition

0
There is an error w/ this script. What is wrong? FiredDusk 1466 — 9y
0
lemme try it real quick bubbaman73 143 — 9y
0
i forgot to add )'s at the end of the true or false things! just add those and you should be fine bubbaman73 143 — 9y
0
there we go i edited it and i should work bubbaman73 143 — 9y
View all comments (2 more)
0
All I have to do is copy the script and paste it right? Dont change anything?? FiredDusk 1466 — 9y
0
no, you have to change the numbers, and decide if you want true or false bubbaman73 143 — 9y

Answer this question