I’m making a jojo game and when a player joins I’m making it so that they spawn everyone’s stands on their client. The problem is when the player joins and I fire the stand summon, script player.Character is nil. To be clear, this script is spawning the stand on other players so that the stands can be client sided. In this script player is not nil but for some reason player.Character is. I’ve tried player.Character:Wait()
and WaitForChild() and checking if the game is loaded with game:IsLoaded() etc. How do I fix this?
Heres my server script:
game.Players.PlayerAdded:Connect(function(Player) FirstJoin[Player.Name] = true Player.CharacterAdded:Connect(function(Character) ContentProvider:PreloadAsync(Character:GetChildren()); --make sure player char is fully loaded before firing if FirstJoin[Player.Name] then --check if player just joined --spawn everyone else's stands FirstJoin[Player.Name] = false for i--[[player]], v--[[value]] in pairs(Active) do print("pairs running") if v then remote:FireClient(Player, i, true) --checks if each player has a stand active and if so --tells the player who just spawned to create the stand for that person end end end for i, v in pairs(Active) do --play all the stand anims for everyone else's stands moveRemote:FireClient(Player, i, MoveState[i]) end Character.Humanoid.Died:Connect(function() --despawn the stand of the player who died remote:FireAllClients(Player, false) end) end) end)
here’s the summon local script:
Summon.OnClientEvent:Connect(function(player, isActive) if not game:IsLoaded() then --attempt at waiting for game to load so player.Character works but it is already loaded so this makes no difference print("loading") game.Loaded:Wait() end local char = player.Character --THIS IS NIL WHEN SECOND PLAYER JOINS FOR SOME REASON (YES PLAYER EXIISTS, AND THE ACTUAL CHAR MODEL EXISTS, AND YES THE GAME IS LOADED) --also the player.Character is the player passed down from the remote event, the player who it is spawning the stand on local hrp = char.HumanoidRootPart if isActive == true then -- summon stand etc etc end end)