Tweening service error?

hello, so i was making a script with tweens and i got this error

TweenPosition is not a valid member of ScreenGui "Players.dashypoo17.PlayerGui.MainMenu"

heres the script

local Gui = script.Parent.Parent

script.Parent.MouseButton1Click:Connect(function(clicked)
	Gui:TweenPosition(UDim2.new(0,0,1,0), "InOut", "Sine",3.5)
	for i = 1,25 do
		wait (0.05)
		game.Lighting.Blur.Size = game.Lighting.Blur.Size - 3
	end
end)

try:

local TS = game:GetService("TweenService")

local Gui = script.Parent.Parent

script.Parent.MouseButton1Click:Connect(function(clicked)
TS:Create(Gui,TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut),{Position = Udim2.New(0,0,1,0)}):Play()

	for i = 1,25 do
		wait (0.05)
		game.Lighting.Blur.Size = game.Lighting.Blur.Size - 3
	end
end)

If that doesnt work make sure you are picking a “Frame” or whatever that can be moved and not a “ScreenGui”

bro could you take a ss of the gui and where the script is located

You can see it clearly in the error he gave.

1 Like

Screenshot 2023-12-15 140305

Players.dashypoo17.PlayerGui.MainMenu.MainFrame.Play.PlayBtn:6: attempt to index nil with 'New'

You are picking the ScreenGui.

replace local Gui = script.Parent.Parent with local Gui = script.Parent.Parent.MainFrame

Replace Udim2.New with UDim2.new

1 Like
MainFrame is not a valid member of Frame "Players.dashypoo17.PlayerGui.MainMenu.MainFrame"

Try replacing that with local Gui = script.Parent.Parent:WaitForChild("MainFrame")

theres no errors but its not working still

Screenshot 2023-12-15 140305

hers the script rn

local TS = game:GetService("TweenService")

local Gui = script.Parent.Parent:WaitForChild("MainFrame")

script.Parent.MouseButton1Click:Connect(function(clicked)
	TS:Create(Gui,TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut),{Position = UDim2.New(0,0,1,0)}):Play()

	for i = 1,25 do
		wait (0.05)
		game.Lighting.Blur.Size = game.Lighting.Blur.Size - 3
	end
end)

@os_clock

what does this mean

Infinite yield possible on 'Players.dashypoo17.PlayerGui.MainMenu.MainFrame:WaitForChild("MainFrame")'

i found a fix with this script

local ui = script.Parent.Parent

script.Parent.MouseButton1Click:Connect(function(click)
 ui:TweenPosition(UDim2.new(0,0,1,0), "InOut", "Sine",0.5)
 for i = 1,25 do
  wait (0.01)
  game.Lighting.Blur.Size = game.Lighting.Blur.Size - 3
  
 end
end)

now the other ui dont dissapear