I am trying to make the GUI tweens I set up play every time a player respawns, however it’s not working…
The background is becoming visible again, but the tweens wont play
heres my code
local tweenService = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local orderText = player.PlayerGui:WaitForChild("Starter").Background.Main.Order
local playBttn = player.PlayerGui:WaitForChild("Starter").Background.Main.Play
local shopBttn = player.PlayerGui:WaitForChild("Starter").Background.Main.Shop
local rose = player.PlayerGui:WaitForChild("Starter").Background.Main.Order.rose
local orderInfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local playInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local shopInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local roseInfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local playGoal1 = {Position = UDim2.new(0.352, 0,0.401, 0)}
local shopGoal1 = {Position = UDim2.new(0.352, 0,0.625, 0)}
local orderGoal1 = {TextTransparency = 0}
local roseGoal1 = {ImageTransparency = 0}
local playGoal2 = {TextTransparency = 1}
local shopGoal2 = {TextTransparency = 1}
local orderGoal2 = {TextTransparency = 1}
local roseGoal2 = {ImageTransparency = 1}
local orderTween1 = tweenService:Create(orderText, orderInfo, orderGoal1)
local orderTween2 = tweenService:Create(orderText, orderInfo, orderGoal2)
local roseTween1 = tweenService:Create(rose, roseInfo, roseGoal1)
local roseTween2 = tweenService:Create(rose, roseInfo, roseGoal2)
local playTween1 = tweenService:Create(playBttn, playInfo, playGoal1)
local playTween2 = tweenService:Create(playBttn, playInfo, playGoal2)
local shopTween1 = tweenService:Create(shopBttn, shopInfo, shopGoal1)
local shopTween2 = tweenService:Create(shopBttn, shopInfo, shopGoal2)
repeat wait() until player.Character:FindFirstChild("Humanoid") ~= nil
if not player.Character:FindFirstChild("Char") then
player.PlayerGui:WaitForChild("Starter").Background.Main.Visible = true
orderTween1:Play()
roseTween1:Play()
task.wait(2.5)
playTween1:Play()
task.wait(.5)
shopTween1:Play()
end
(i dont really care about the number of variables, i know it can be done with a lot less but i do it like this)
“Char” is a value inside all of the characters in the game, but it’s not added to the player’s character so i dont see why its not working