It’s very inconvenient to have to re-write every PlayerAdded and CharacterAdded event connection to be compatible with the special needs of roblox studio because it creates the player (and maybe even the character) before running any of the scripts in the game.
local function AddPlayer(player)
local function AddCharacter(character)
spawn(function() -- another unnecessary hack; see devforum.roblox.com/t//48808
character.HumanoidRootPart.CFrame = CFrame.new(256, 10, 256)
end)
end
player.CharacterAdded:Connect(AddCharacter)
if player.Character then
AddCharacter(player.Character)
end
end
game.Players.PlayerAdded:Connect(AddPlayer)
for _, player in pairs(game.Players:GetPlayers()) do
AddPlayer(player)
end)
Agreed. It’s pretty annoying having to write all that extra code just to properly test within Studio.
Assuming this is basically a race-condition issue, I guess the only fix I can think of is to make sure scripts run a single tick before adding any player object.
Just to confirm, by “in studio”, you mean Play Solo, right? Testing via Test->Local Server, 1 Player should work the same as a deployed place, complete with support for FE. Play Solo is a special case, and kind of a compromise for fast iteration at the expense of not behaving identically to a separate server and client. Right now, getting all your startup code that works live to also work in Play Solo does usually require some extra boilerplate stuff to tolerate things being already loaded, near-zero latency, and transfer of the studio build camera over to being the in-game camera.