Tween not Playing

This just worked an hour ago, and now its broken. I don’t know what’s wrong :sob:

local TweenService = game:GetService("TweenService")
local Info1 = TweenInfo.new(2, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut)
local TPdebounce = false

local TPGoalIn = {}
TPGoalIn.Position = UDim2.fromScale(0, 0)
local TPGoalOut = {}
TPGoalOut.Position = UDim2.fromScale(0, -2)

BallroomUI.MouseButton1Click:Connect(function()
	if TPdebounce == false then
		TPdebounce = true
		TweenService:Create(BallRoomTPImage, Info1, TPGoalIn):Play()
		print("Loaded Tween...")
		wait(2)
		LocPlayer.Character.HumanoidRootPart.CFrame = BallroomLoc.CFrame
		print("Teleported!")
		wait(1)
		TPGuiText.Text = "Success!"
		wait(2)
		TPGuiText.Text = "Ballroom Loaded."
		wait(2)
		TweenService:Create(BallRoomTPImage, Info1, TPGoalOut):Play()
		print("Loaded Tween Out...")
		wait(2)
		BallRoomTPImage.Position = UDim2.fromScale(0, 2)
		print("Change Position of the UI!")
		wait(3)
		TPdebounce = false
	end
end)

Teleportation worked properly, but the rest of the contents inside is not working as intended sobbinG

this is the output
image

BallRoomTPImage and BallroomLoc in the code are not defined in the snippet you provided.
Also, ensure that the event BallroomUI.MouseButton1Click is correctly bound to the UI element.

local TPFrame = CoreGUI:WaitForChild("MainGUI"):WaitForChild("Frame"):WaitForChild("TeleportMenu"):WaitForChild("ScrollingFrame")
local BallroomUI = TPFrame:WaitForChild("Frame1"):WaitForChild("Image")

local TPGui1 = script.Parent.Parent:WaitForChild("TeleportGUI")
local BallRoomTPImage = TPGui1:WaitForChild("Frame"):WaitForChild("BallroomTPimage")
local TPGuiText = BallRoomTPImage:WaitForChild("2Frame"):WaitForChild("TextLabel")

local TweenService = game:GetService("TweenService")
local Info1 = TweenInfo.new(2, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut)
local TPdebounce = false

-- Locations
local Locations = game.Workspace:WaitForChild("Locations")
local BallroomLoc = Locations:WaitForChild("BallroomLocation")

-- Goal
local TPGoalIn = {}
TPGoalIn.Position = UDim2.fromScale(0, 0)
local TPGoalOut = {}
TPGoalOut.Position = UDim2.fromScale(0, -2)

BallroomUI.MouseButton1Click:Connect(function()
	if TPdebounce == false then
		TPdebounce = true
		TweenService:Create(BallRoomTPImage, Info1, TPGoalIn):Play()
		print("Loaded Tween...")
		wait(2)
		LocPlayer.Character.HumanoidRootPart.CFrame = BallroomLoc.CFrame
		print("Teleported!")
		wait(1)
		TPGuiText.Text = "Success!"
		wait(2)
		TPGuiText.Text = "Ballroom Loaded."
		wait(2)
		TweenService:Create(BallRoomTPImage, Info1, TPGoalOut):Play()
		print("Loaded Tween Out...")
		wait(2)
		BallRoomTPImage.Position = UDim2.fromScale(0, 2)
		print("Change Position of the UI!")
		wait(3)
		TPdebounce = false
	end
end)

everything is correct, I provided the output and it teleported me, so pressing the UI/Image in this scenario worked for me.

But the Tween, along with the Text Changes did not change when I checked it on explorer.

Not sure this will help but worth a try …

A bit of reformatting
local TPFrame = CoreGUI:WaitForChild("MainGUI"):WaitForChild("Frame"):WaitForChild("TeleportMenu"):WaitForChild("ScrollingFrame")
local BallroomUI = TPFrame:WaitForChild("Frame1"):WaitForChild("Image")

local TPGui1 = script.Parent.Parent:WaitForChild("TeleportGUI")
local BallRoomTPImage = TPGui1:WaitForChild("Frame"):WaitForChild("BallroomTPimage")
local TPGuiText = BallRoomTPImage:WaitForChild("2Frame"):WaitForChild("TextLabel")

local TweenService = game:GetService("TweenService")
local Info1 = TweenInfo.new(2, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut)
local TPdebounce = false

-- Locations
local Locations = game.Workspace:WaitForChild("Locations")
local BallroomLoc = Locations:WaitForChild("BallroomLocation")

BallroomUI.MouseButton1Click:Connect(function()
	if not TPdebounce then
		TPdebounce = true
		local tweenIn = TweenService:Create(BallRoomTPImage, Info1, TPGoalIn)
		tweenIn:Play()
		tweenIn.Completed:Wait() -- Wait for the animation to complete

		LocPlayer.Character.HumanoidRootPart.CFrame = BallroomLoc.CFrame

		TPGuiText.Text = "Success!"
		task.wait(2) -- Delay for 2 seconds using task.wait()

		TPGuiText.Text = "Ballroom Loaded."
		task.wait(2) -- Delay for 2 seconds using task.wait()

		local tweenOut = TweenService:Create(BallRoomTPImage, Info1, TPGoalOut)
		tweenOut:Play()
		tweenOut.Completed:Wait() -- Wait for the animation to complete

		BallRoomTPImage.Position = UDim2.fromScale(0, 2)
		task.wait(3) -- Delay for 3 seconds using task.wait()

		TPdebounce = false
	end
end)

Let me try and I’ll get back right at ya, ty ty hold on rq

It seems like you’re trying to create a teleportation function that involves a UI transition using TweenService in Roblox Lua. The code you provided has a few issues. I’ll explain the issues and provide a corrected version:

Issues:

  1. The BallroomUI and BallroomLoc variables are not defined in the code. These should be references to the UI button and the destination location, respectively.
  2. You are using wait to pause the script execution, but this can cause the UI to freeze, and the player may experience lag during teleportation.
  3. The BallRoomTPImage and TPGuiText objects are not defined in your code. You need to ensure that these objects exist in your game.

Correction: Here’s a corrected version of your code, assuming you have the necessary objects and references:

local TweenService = game:GetService("TweenService")
local BallroomUI = -- Reference to the UI button
local BallroomLoc = -- Reference to the destination location
local BallRoomTPImage = -- Reference to the UI image you want to animate
local TPGuiText = -- Reference to the UI text element

local Info1 = TweenInfo.new(2, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut)
local TPdebounce = false

local TPGoalIn = {}
TPGoalIn.Position = UDim2.fromScale(0, 0)
local TPGoalOut = {}
TPGoalOut.Position = UDim2.fromScale(0, -2)

BallroomUI.MouseButton1Click:Connect(function()
    if not TPdebounce then
        TPdebounce = true
        TweenService:Create(BallRoomTPImage, Info1, TPGoalIn):Play()
        print("Loaded Tween...")

        wait(2)

        -- Teleport the player's character
        local LocPlayer = game.Players.LocalPlayer
        LocPlayer.Character:MoveTo(BallroomLoc.Position)  -- Assuming BallroomLoc is a Vector3

        print("Teleported!")

        wait(1)
        TPGuiText.Text = "Success!"
        wait(2)
        TPGuiText.Text = "Ballroom Loaded."
        wait(2)
        TweenService:Create(BallRoomTPImage, Info1, TPGoalOut):Play()
        print("Loaded Tween Out...")
        wait(2)
        BallRoomTPImage.Position = UDim2.fromScale(0, 2)
        print("Change Position of the UI!")
        wait(3)
        TPdebounce = false
    end
end)

Make sure to replace the placeholders (BallroomUI , BallroomLoc , BallRoomTPImage , and TPGuiText ) with the actual objects in your game. Also, adjust the teleportation logic to match your game’s needs.

Please STOP USING ChatGPT for goodness sake, it’s frowned upon and bannable, and doesn’t fix anything as the OP could have already done this himself.

2 Likes

I think TPGoalIn and TPGoalOut should be

local TPGoalIn = {['Position'] = UDim2.fromScale(0,0)}
local TPGoalOut = {['Position'] = UDim2.fromScale(0,-2)}

comments dont equal chat gpt dude lol

sadly, it didn’t work…
image

The output still gives the same, this means the code worked but the tween isn’t correctly playing.
GIF got cut before it can give the final print

Here’s the explorer of the Transition
image

Here’s the explorer for the Button

chatgpt detector says that it’s chatgpt, and he also specified Roblox Lua which isn’t a normal thing. as i’ve already said, the OP could have just done the exact same thing, and that chatgpt usually provides false information when asked whats wrong with code that factor numbers

why didnt he just use the new roblox assistant instead lol the roblox assistant is actually good it knows metatables and stuff

the code works… the tween is just broken. Even if the code is correctly written. And I have specifically set all of the references for the transition script

Think that is one of the 1st replies I have ever used comments on. I looked at ChatGPT long ago. Got sick of teaching it how to program. I was more looking for ways to pause it. This stuff is hard without full context, end up guessing more than anything.

what is it supposed to look like and send a video of it currently

chatgpt premium is actually good at lua programming though it knows the difference between client and server and can do a bunch of stuff. roblox assistant is still better though.

I’ll just send pictures of how it should work… it takes me a lot of time to send a video since I’m using OBS to record, and the GIF Recorder im using only records 7 seconds, plus the Transition isn’t even working so… here you go

Scenario 1: This is when Pressing the Button

Scenario 2: Start of transition going Up

Scenario 3: This is where the Teleportation and Text Changes happen

Scenario 4: Transition is done


I dont see any difference between the ui pictures

the Transition is suppose to go Up, and will stop at the Middle that shows Scenario 3 where it will show what place they will be teleporting too.