The GUI is supposed to move from off the screen onto the right, to the halfway across the screen and then back to where it was originally located, but for some reason its going too far across and I've been adjusting the position but I cant seem to find where the exact middle is (both sides).

ex. https://gyazo.com/b0e1489e481a29dafe1158210088844a

script for left side

wait(1)
pressed = false;

script.Parent.Touched:connect(function(p)
	local player = p.Parent;
	local actualPlayer = game.Players:FindFirstChild(player.Name);

	if not pressed then
		pressed = true;
		
		actualPlayer.PlayerGui.L.Frame:TweenPosition(
			UDim2.new(0.005, 0, 0, 0),
			"Out",
			"Linear",
			1.5
		);
		
		wait(2);
		
		actualPlayer.PlayerGui.L.Frame:TweenPosition(
			UDim2.new(-1, 0, 0, 0),
			"Out",
			"Linear",
			1.5
		);
		
		wait(2);
		
		actualPlayer.PlayerGui.L.Frame.Position = UDim2.new(-1, 0, 0, 0);
		
		pressed = false;
	end
end)

script for right

wait(1)
pressed = false;

script.Parent.Touched:connect(function(p)
	local player = p.Parent;
	local actualPlayer = game.Players:FindFirstChild(player.Name);

	if not pressed then
		pressed = true;
		
		actualPlayer.PlayerGui.R.Frame:TweenPosition(
			UDim2.new(-0.005, 0, 0, 0),
			"Out",
			"Linear",
			1.5
		);
		
		wait(2);
		
		actualPlayer.PlayerGui.R.Frame:TweenPosition(
			UDim2.new(1, 0, 0, 0),
			"Out",
			"Linear",
			1.5
		);
		
		wait(2);
		
		actualPlayer.PlayerGui.R.Frame.Position = UDim2.new(1, 0, 0, 0);
		
		pressed = false;
	end
end)

1 comment

0

Find your middle just with a normal frame without the script and copy these positions to the script but first put it the frame in the middle without the script its alot of easier to work then when you have it you can remove that frame back and can do the frames of the scripts correct