Tweening Gui issue

I have a gui, in this gui you can choose your difficulty level, when you press normal easy or hard, start button show up the issue is i have a reset button this button will be resetting localplayer game. So when reset button pressed the starter gui will be showed up, it shows up but start button doesnt come up. Here is a little clip what i mean

Output:

1 Like

That seems odd to see, but we can’t help without seeing your code, could you show us the script?

1 Like

Yeah sure

This is Reset Button Script:

local button  = script.Parent.TextButton
local Remote = game.ReplicatedStorage.CheckPoint
local NPC = game.Workspace:WaitForChild("CellatBaba")
local player = game:GetService("Players").LocalPlayer
local speed = player.PlayerGui:WaitForChild("Speed"):WaitForChild("Frame")
local start = player.PlayerGui:WaitForChild("Start"):WaitForChild("Start")


button.MouseButton1Up:Connect(function()

	speed:TweenPosition(
		UDim2.new(0, 0,-0.068, 0),
		"Out",
		"Quad",
		1						
	)
	game.Players.LocalPlayer.Character.Humanoid.Health = 0
	Remote:FireServer()
	NPC:SetPrimaryPartCFrame(CFrame.new(game.Workspace.Teleport.Position))
end)

This is difficulty script (3 of them are same)

local Frame = script.Parent.Parent
local Button = script.Parent

local start = game.StarterGui.Start.Start

local player = game:GetService("Players").LocalPlayer
local start = player.PlayerGui:WaitForChild("Start"):WaitForChild("Start")

function Start()
	start:TweenPosition(
		UDim2.new(0.5, 0,0.88, 0),
		"Out",
		"Quad",
		0.7,2		
	)
end
function Speed()
	Frame:TweenPosition(
		UDim2.new(0, 0,-2, 0),
		"Out",
		"Quad",
		2						
	)
end
Button.MouseButton1Up:Connect(function()
	Speed()	
	Start()	
end)



1 Like

Try this for your difficulty script?

local Frame = script.Parent.Parent
local Button = script.Parent

local player = game:GetService("Players").LocalPlayer
local start = player.PlayerGui:WaitForChild("Start"):WaitForChild("Start")

function Start()
	start:TweenPosition(
		UDim2.new(0.5, 0,0.88, 0),
		"Out",
		"Quad",
		0.7		
	)
end

function Speed()
	Frame:TweenPosition(
		UDim2.new(0, 0,-2, 0),
		"Out",
		"Quad",
		2						
	)
end

Button.MouseButton1Up:Connect(function()
	Speed()	
	Start()	
end)

I think it was treating it as if you were tweening something from StarterGui cause of that first line you had

local start = game.StarterGui.Start.Start
1 Like

I deleted that part but still same output

1 Like

In this reply, assume “x” is what you would be tweening.

When the error occurs, keep the game running, and go to Players > xFurkanToDie > PlayerGui > The UI you are using .... x

If the x isn’t there, then the error sources from x either not being parented correctly, or being destroyed.

If the x is there, the error is from tweening something that is off-screen.

I also recommend you use TweenService instead for less memory usage, smoother transitions, and most importantly, descriptive error messages.

1 Like

Hmm i didnt destroyed the Start button but i tweened to where start button comes from

1 Like

What do you mean something off-screen ?

1 Like

Since you didn’t destroy the button, what is it’s position and parent when the error occurs?

1 Like

Here is a before tweening position:

0.5, 0,1.355, 0

Here is a after tweening position:

0.5, 0,0.88, 0

And this is a after button pressed position:

0.5, 0,1.355, 0

image

TextButton is a StartButton and Parent is Start Frame

1 Like

Whatever you’re tweening is causing the error, it either does not exist at the time or is re-parented.

That error only occurs when the parent of the tween object is set to nil, or another area out of the UI that is considered “out the workspace” (with the workspace being the UI itself). There is no other possible way to recreate the error.

This can happen by either changing the parent or destroying the tweened instance.

1 Like

Okey what can i do to solve this problem? any idea?

1 Like

That would be something to do on your end. Make sure you didn’t destroy a certain instance, re-parent it, etc.

1 Like

I checked i didnt destroying or re-parenting

It says problem is here but it didnt seems like a problem to me

That’s not where the problem lies, that’s where the error occurs.
Look through all your code.