local lighting = game:GetService('Lighting')
local blur = lighting:WaitForChild('Blur')
local frame = script.Parent
local XY = frame.Parent
local ui = XY.Parent
local gui = ui.Parent
local hud = gui:WaitForChild('HUD')
local title = frame:WaitForChild('Title')
print('1')
game.Players.PlayerAdded:Connect(function(player)
print('2')
repeat wait() until player.Character
print('3')
XY:TweenPosition(UDim2.new(0, 0, 0.5, 0), 'Out', 'Quad', 1, false)
wait(5)
XY:TweenPosition(UDim2.new(0, 0, 1.3, 0), 'Out', 'Quad', 1, false)
wait(0.5)
for i = 30, 0, -3 do
blur.Size = i
wait()
end
hud.Enabled = true
ui:Destroy()
end)
Prints 1, but nothing after the player added function. Wiki states that works with client now so idk why it ain’t working for this. This is all in a LocalScript, which the wiki states:
Up until recently, this event didn’t work on the client (in Localscript s), but this has been changed
The script loads in after the player does, it’s not logically possible for it to detect PlayerAdded because the player itself is already added by the time the script runs.
How would I go abouts having a local script wait for the player to join before firing something (for say an intro to a game) without having to connect remote events and all that
If I’m understanding you correctly then all you need to do is create a local script with a wait(x) delay and parent it to StarterPlayerScripts or ReplicatedFirst, no need for the PlayerAdded listener since the script will be localized to the player itself and will run when it’s ready.
@SummerEquinox comment is probably yoru best bet for what you are trying to do.
For my style of coding I do the folowing:
For client sided operations I would recomend keeping the player’s client slightly seperate from the rest of the players if you are using PlayerAdded. The idea here is you can check for the local client details first and add what ever that client needs, then check for the rest of the players using PlayerAdded or a loop through all the current players for their own sorts of functions that you may require.
This is useful for when you have all sorts of complicated client sided effects for your character and you apply them first. Every other client can have seperate functions for replication and so forth. This is great for when you are replicating players client sided instead of server sided.
If I understand you correct, you want it to fire when the player joins? You don’t have to use playeradded, as the script will automatically go off when it has loaded. If you want to wait until the game is loaded, use game:IsLoaded()