How do I make a local script detect if the local player joined the game

Maybe you can check if a player joined using RemoteEvents?

im not very used to using remote events, how would i make it work?

Could you explain in a bit more depth on what you want to achieve so I could guide you?

so what i have is a title screen for a game im working on, and i want it so that when the player presses the “play” button, the camera goes to normal and stays like that, however everytime they die, it returns their camera to the part, im trying to fix this by only activating the camera script when the player joined, which didnt work via local script.

Put the title screen into PlayerScripts and then make it so the localscript inside the title screen changes the title screens parent to the LocalPlayer’s PlayerGui. This’ll make it so the title screen will only run once

okay so
in a server script you could do something like:

game.Players.PlayerAdded:Connect(function(plr)
RemoteEvent:FireClient()
end)

Local script

RemoteEvent.OnClientEvent:Connect(function()
-- Enter code here
end)

but then would i have to send any data? such as the players useridd? if so how would i do that?

just do this:
server:

game.Players.PlayerAdded:Connect(function(plr)
RemoteEvent:FireClient(plr.UserId)
end)

local script:

RemoteEvent.OnClientEvent:Connect(function(plr.UserId)
-- Enter Code here
end)

Bruh why you using remote scripts when they aint needed

It’s just one solution out of many, I never said it’s the only one

Fair enough. I guess it just seems like a waste to user server performance for an intro script

i just need the soulution to prevent the script from running every time a player dies, i would rather not use remote events

Put the title screen into PlayerScripts and then make it so the localscript inside the title screen changes the title screens parent to the LocalPlayer’s PlayerGui. This’ll make it so the title screen will only run once

StarterGui.ResetOnSpawn = false

If it is a LocalScript inside of StarterGui, put it in game.StarterPlayer.StarterPlayerScripts.

That is a good solution but then you screw up any other gui’s he may have in that directory

oh i think that might work, lemme try it

Okay then maybe use script.Disabled

game.Players.PlayerAdded:Connect(function(plr)
PlayButton.MouseButton1Click:Connect(function()
game.CameraManipulationScript.Disabled = true
end)

Something like that, just refine it

now i need some way i having the script disable? since i have a button in startgui that disables it, but the starterplayerscript is in a different place?

nevermind i found how to do it, thanks!

This looks like a good use of ReplicatedFirst - the title screen script could go there and it should only run once.

ReplicatedFirst scripts are run when the player joins the game, so you shouldn’t need any event with this solution. If you need to wait for the players character to be created, you can use player.CharacterAdded:Wait()