Button missing?

The problem

So I created a simple GUI that has 2 (currently unfunctional) buttons. A play button and a credits button.

I created a script for the credits button that in theory should animate a side GUI.

The Script

local tweenService = game:GetService("TweenService")
local Button = script.Parent
local GUI = Button.Parent.Parent.TextFrame
local FirstPos = UDim2.fromScale(0,0)
local LastPos = UDim2.fromScale(0.65,0.5)
local tweenInfo = TweenInfo.new(1)


GUI.Position = FirstPos

local anim = tweenService:Create(GUI, tweenInfo, LastPos)


Button.MouseButton1Click:Connect(function()
	anim:Play()
end)

The problem (cont.)

However, When playtesting the credits button (script.Parent) is gone. I have checked the explorer for problems and in the explorer, it’s deleted. I never put any code in to delete the GUI and the only free model I used has been stripped down to just parts unions and meshes. (it had some scripts in it for a reason that I didn’t need at the moment)

Whoops. Forgot to update the code from when I was trying to see what was wrong

use GUI:TweenPosition I think, is better

How do you do that? Is there something else I am missing or is it just that?

Is it possible that because you set the GUI.Position to be FirstPos, and because FirstPos is (0,0) it deletes it?

Not sure. Ill try to see what happens if i remove that piece of code

Nope. Just removed that piece and yet it still deletes the button

check in your playergui to see if the button is deleted or where it is

I have already checked. In playerGUI its just deleted.

Hold on are you trying to make the GUI tween down and then it’s gonna open into a new screen with the credits?

No im trying to make a new screen (the credits) tween RIGHT Without removing the other GUI

Huh, I think if you’re trying to make it move positions, you could use :TweenPosition
I haven’t used it myself but I’m pretty sure its what you’re looking for

Im checking it out right now actually. Although not sure if it will fix my disapearing button problem

Still gone. Replaced it with tween position but the button still deletes.

local tweenService = game:GetService("TweenService")
local Button = script.Parent
local guiObject = Button.Parent.Parent.TextFrame
local FirstPos = UDim2.fromScale(0,0)
local LastPos = UDim2.fromScale(0.65,0.5)
local tweenInfo = TweenInfo.new(1)


guiObject.Position = FirstPos


Button.MouseButton1Click:Connect(function()
	local play = guiObject:TweenPosition(LastPos, Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 1.5, false)
	
	if play then 
		print("did it work?")
	end
end)

If you’re trying to get the current GUI to shift over to the right you could try something like

Button.MouseButton1Click:Connect(function()
     GUI:TweenPosition(
      UDim2.new(x,x,y,y),
      Enum.EasingDirection = X,
      Enum.EasingStyle = X,
      true/false (override other tweens I think),
      1 (However long you want it to last)
)

and this should be closer to what you want
edit: don’t forget commas smh

Ok let me try it out. This looks pretty accurate

No. The button is still gone. i dont think its the script anymore at this point

Do you have any other scripts that might be deleting the button?

No. This is the only script at the moment (at least to my knowledge) and i just temporarily removed all the code in it and its still gone

I’m out of ideas then, maybe try making a new button to see if that works? This is confusing because it doesn’t make the button invisible or anything, it just deletes it

Turns out there was two other scripts that were responsible for fire spread (in the one free model i used). I dont know if those were doing anything malicious but i removed them anyways