UI Tween not working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Im trying to tween a UI to appear on screen.

  2. What is the issue? Include screenshots / videos if possible!
    It just… won’t tween, I put debugging logs and it says its at the right position but if I check in explorer its still at its default.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried tweenpostion and it said it could only tween stuff in workspace.

local CollectionService = game:GetService("CollectionService")
local TweenService = game:GetService("TweenService")

local Player = game:GetService("Players").LocalPlayer
local HudU = Player.PlayerGui:WaitForChild("Hud")
local ShopHud = HudU:WaitForChild("ShopUI")
local TacHud =  HudU:WaitForChild("TacticalUI")
local camera = workspace.CurrentCamera
local TweenFrame = ShopHud:WaitForChild("TweenFrame")
local CivilStore = CollectionService:GetTagged("CivilStore")
local DStore = CollectionService:GetTagged("ClassDStore")
local CombatStore = CollectionService:GetTagged("CombattiveStore")

local StoreTweenInfo = TweenInfo.new(1,Enum.EasingStyle.Back, Enum.EasingDirection.InOut)
local CameraTweenInfo = TweenInfo.new(0.5,Enum.EasingStyle.Quart, Enum.EasingDirection.Out)





for i,Store in pairs(CivilStore) do
	local ShopGuy = Store.Parts.ShopDude
	
	Store.OpenProximityPrompt.ProximityPrompt.Triggered:Connect(function()
		local OriginalFace = ShopGuy.Head.face.Texture
		local TalkingFace = "http://www.roblox.com/asset/?id=1005618525"
	
		
		local Goal = {}
		Goal.Position = UDim2.new(0.5,0,0.5,0)
		local CameraTween = TweenService:Create(camera, CameraTweenInfo, {CFrame = Store.Parts.Camera.CFrame})
		local StoreTween = TweenService:Create(TweenFrame,StoreTweenInfo, Goal)
		
		Store.OpenProximityPrompt.ProximityPrompt.Enabled = false
		camera.CameraType = Enum.CameraType.Scriptable
		CameraTween:Play()
		TacHud.Enabled = false
		ShopHud.Enabled = true
		CameraTween.Completed:Wait()
		StoreTween:Play()
		print("PlayingShopTween")

		-- Print debugging information
		print("Initial Position:", TweenFrame.Position)
		wait(1)
		print("Final Position:", TweenFrame.Position) 
	end)
end

To tween the position of UI elements, you need to use the TweenPosition function. You may find this link useful:
TweenPosition - Frame | Documentation
TweenPosition - Documentation

I hope this helps to solve your problem :slight_smile:

1 Like

You gave little information. Explain in more detail what specifically does not work in your script and on which line the script does stop working.

I tried this earlier and it didn’t work and gave me the error “Can only tween objects in workspace”

I am trying to tween a frame which childrens are other stuff such as buttons, other frames, image labels,
etc. theoretically this should bring all of its children with it… right? However when I tween it nothing moves even though the debugging prints which print its position say its at the right spot. However if I look at its properties in the explorer tab it is still at its default postion.

This is a local script, right?

Mhm, in starterplayerscripts. Its a script that handles all the shops in my game using collectionservice