UITween On Join

So, I’m making it so when a player joins the game it shows a disclaimer screen with a tween.

I’m running:
game.Players.PlayerAdded:Connect(function(joined)
wait(2)
UIin()
end)

and its not working.

You’re doing this on the client right?
And if you are, the PlayerAdded event fires before the player loads in most of the time.
Just put UIin() into the top of the script and it should work.

How would I make it so that it fires after the player joins?

You can’t.
Try this:

repeat task.wait() until game.IsLoaded
UIin()

This can be put in a localscript, correct?

Yeah.

Weird, its in the screengui, in a frame
local Player = game.Players.LocalPlayer
local MainFrame = Player.PlayerGui.y.Frame2

local Button = MainFrame.TextButton

local TargetPosition = UDim2.new(0.339, 0,0.131, 0)
local AfterPosition = UDim2.new(0.339, 0,-1, 0)

function UIin()
MainFrame:TweenPosition(TargetPosition)
end

function UIout()
MainFrame:TweenPosition(AfterPosition)
end

game.Players.PlayerAdded:Connect(function(joined)
repeat task.wait() until game.IsLoaded
UIin()
end)

Button.MouseButton1Click:Connect(function(out)
UIout()
wait(2)
MainFrame:Destroy()
end)

this is the whole script

Remove the PlayerAdded connection entirely and put the stuff inside at the bottom of the script and see if that works

Thanks for the help! It worked.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.