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")
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)
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:
The BallroomUI and BallroomLoc variables are not defined in the code. These should be references to the UI button and the destination location, respectively.
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.
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.
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
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.
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