TweenService does not work on frame

Hi! I have a very weird problem, and it’s concerning this piece of code

Trigger.OnClientEvent:Connect(function()
	Tween(game.Workspace.CurrentCamera, MainCam)
	Choices:TweenPosition(UDim2.new(0.56, 0, 0.399, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Circular)
end)

The Choices is a frame element and the code somehow bugs???

Here’s a video of what I mean:
robloxapp-20220821-1117042.wmv (614.8 KB)

It just goes to the corner and just doesn’t tween. I don’t know what the problem is, but it just doesn’t work??? Can someone help me with this?

I haven’t seen roblox do that before
maybe make sure the frame was created on clientside like from starterGui or from a local script

Screenshot (171)
This is all of the assets that are in here, I’ve also checked other models of mine that incorporate the TweenPosition and they work fine. I don’t know why this one doesn’t.

Edit: I’ve also tried resetting Roblox Studio, still bugs out :confused:

do you maybe have any other scripts that tween or move that frame? maybe one is triggering at the same time as this tween, or right before the tween triggers

None, the LocalScript is the only script that’s there

it could be inside of this local script

Yeah, all of the code is inside that local script.

no, I meant that the issue could be other code in the local script

Should I send the whole script to you? I honestly don’t know what’s wrong with it.

local TweenService = game:GetService("TweenService")
local Camera = workspace.CurrentCamera
local tweenInf = TweenInfo.new(1, Enum.EasingStyle.Circular, Enum.EasingDirection.Out, 0, false, 0)
local tweenInfText = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)

local NPC = game.Workspace.NPCGroup.NPC
local MainCam = game.Workspace.NPCGroup.Camera
local Player = game.Players.LocalPlayer
local Character = Player.Character

local Dialog = script.Parent.Parent.DialogueHolder
local Choices = script.Parent
Choices.Position = UDim2.new(0.53, 0, 0.399, 0)
local DialogText = Dialog.Dialogue
local NPCName = Dialog.NPCName

local function typeMessage(txt, typeTime)
	for i=1, #txt do
		DialogText.Text = string.sub(txt, 1, i)
		wait(typeTime / #txt)
	end
end

local RepSto = game.ReplicatedStorage
local Trigger = RepSto.DialogChoiceTrigger
local CorrectChoice = RepSto.CorrectChoice

function Tween(Camera, cameranew)
	local info = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
	Camera.CameraType = Enum.CameraType.Scriptable
	local tween = TweenService:Create(Camera, tweenInf, {CFrame = cameranew.CFrame})
	tween:Play()
end

Trigger.OnClientEvent:Connect(function()
	Tween(game.Workspace.CurrentCamera, MainCam)
	Choices:TweenPosition(UDim2.new(0.56, 0, 0.399, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Circular)
end)

This is the entire script. It’s not the final version yet since I am just testing it.

is it supposed to tween from 0,0,0,0 to 0.53,0,0.399,0? you’re setting it to that position at the beginning of the script

Nope, the 0.53… is the starting point, the TweenPosition is the end point

try setting the parent of Choices after setting its position to maybe stop the teleporting from when it loads
then for the tweening, what’s triggering the OnClientEvent? is it when you click an option?

For the first one, I don’t really get what you mean?

For the second one, it’s triggered by a prompt trigger, and inside the prompt is a server script which does a FireClient() and connects to the Trigger on the local script

oh, I misread your code earlier with

local Choices = script.Parent
Choices.Position = UDim2.new(0.53, 0, 0.399, 0)

I think you should set the position in the explorer before the game starts instead besides this

Did that as well, but it just does the same thing again :confused:

not sure then
idk what else could be doing that

If you have a friend that knows UI Design, then can you please @ them here? Thank you in advance :slight_smile:

Thanks for the help, though!

Nvm! I just fixed it. I rewrote the TweenPosition and it just worked??? Probably a bug on Roblox’s end.

1 Like