There is a spawning issue i cant fix

hello, there is an issue where when i respawn a lot of people, they stack up instead of being in the same spot, is there any way i can fix ths issue?

3 Likes

You can fix this by disabling their collisions with each other.

Step 1: In Models, find Collision Groups and click it. Add a new collision group and name it, ‘Players’ disable the collisions with itself.

Step 2: Create a server script in ServerScriptService.
The Script:

game.Players.PlayerAdded:Connect(function(player) --Gets the joined player(s)
    player.CharacterAdded:Connect(function(character) --Gets the player's character
        for i, part in pairs(character:GetChildren()) do --Loops through each instance inside the character
            if part:IsA("BasePart") then --Checks if it's a BasePart. (LeftLeg, RightLeg, Head, Torso, etc.)
                part.CollisionGroup = "Players --Sets the collision group to the created group.
            end
        end
    end)
end)

Hope this helps!

1 Like

im not reallt sure on what you mean about models. also to clarify, the game is already set so thwt people arent collided, but when we respawn them (this is an obby game) and they go to the spawn, it stacks.

1 Like

Did you put the collisiongroup setting inside a player.CharacterAdded function?

1 Like

[quote=“Screwed, post:4, topic:2775951, full:true, username:haydengamingdo”]
Did you put the collisiongroup setting inside a player.CharacterAdded function?
[/quote] here is the script
Screenshot_2024-01-02_at_22.04.54

2 Likes

Create the collision group inside the collisiongroup service.
Revamped Script:

function NoCollide(character)
    for i, obj in pairs(character:GetChildren()) do
        if obj:IsA("BasePart") then
          obj.CollisionGroup = "p"
        end
    end
end

game.Players.PlayerAdded:Connect(function(player) --Gets the player instance.
    player.CharacterAppearanceLoaded:Connect(function(char) --Gets the character each time the character's appearance loads.
        NoCollide(char)
    end)
end)
1 Like

the stacking is still continuing. as i said b4, its not about the collision because the game has already been set to have no collision. if u want a clip i can send

1 Like

Send it please!

limitlimitlimit

1 Like

How would they stack if they can’t collide with each other?

1 Like

@Katrist @haydengamingdo https://media.discordapp.net/attachments/827255557030150154/1192133534433955940/RPReplay_Final1704234336.mov?ex=65a7f7df&is=659582df&hm=5a4c8a013945b3e9bb304bbc2db973b7b8e047082f1fde9b29ca08d4fc3b928e&

if you are unable to see the link, basically what happens in the clip is that when i respawn them, for some reason it lags A LOT for 1-2 seconds and if theres a lot of players, they get stacked.

Why not let them NOT respawn at the same time?

because it is a game where they all need to be respawned, the last few players get eliminated if they dont finish the obby before others.

if they are not respawned at the same time, it would make it unfair.

Show me your current script.

limit

show the current script of what

The collision setting script that you use.

the one that you sent us.

local PlayerGroup = PhysService:RegisterCollisionGroup("p")
PhysService:CollisionGroupSetCollidable("p","p",false)

function NoCollide(character)
    for i, obj in pairs(character:GetChildren()) do
        if obj:IsA("BasePart") then
            obj.CollisionGroup = "p"
        end
    end
end

game.Players.PlayerAdded:Connect(function(player) --Gets the player instance.
    player.CharacterAppearanceLoaded:Connect(function(char) --Gets the character each time the character's appearance loads.
        NoCollide(char)
    end)
end)```

but additionally, there is another issue. when we respawn them, it creates a lot of lag for 1-2 seconds + the fact that theyre stacking.

Remove this, go to Model, click Collision Groups, and create a new Collision Group called ‘p’

What do you mean by “Model”, because I’m not sure what this means.