Collision Group Not Working After Respawn

When I use the skill on the dummy the characters are placed correctly, and no collision issues occur. After the dummy dies the collision group seems to not work anymore even though I assign the collision group of each limb to a collision group that cannot collide with any other collision group and itself. I don’t change the collision group settings or anything in the script either.

First Time Doing Skill (No collision issues and characters are placed how the animation intends them to. In this the dummy lands perfectly on its black with no sliding or collision issues.)
image

This time (not as noticeable in the picture I guess, but in this part the player slides and somehow collides with the dummy and ground. (Could be the dummy))
image

2 Likes

bump, having this issue too
really frustrating because i can’t find a good workaround

apparently after both the affected dummy and player are respawned, the issue doesn’t persist (on my end, at least).

update: if the grabber spawns after the target, the collisiongroups function normally

That is because when you use characters in CollisionGroups, you put their character model in the group. Whenever a player dies, it results in their model getting deleted with the pre-existing CollisionGroup settings alongside it and respawning a new model.
You probably have not properly set up a script to handle player respawning and setting the CollisionGroup again.

I suggest showing any form of scripts to verify if that is the case. Without it there’s not much I can do.


Edit: Replied to wrong person.

local players = game:GetService("Players")
local player = players:GetPlayerFromCharacter(script.Parent)
player.CharacterAdded:Wait()
for i, v in ipairs(script.Parent:GetDescendants()) do
	if v:IsA("BasePart") then
		v.CollisionGroup = "Player"
	end
end

is used on spawn (it’s in StarterCharacterScripts)
the collisiongroup is already set through the studio tab

also, i tested it with actual players and both players are just treated as if they’re in the ‘default’ collisiongroup

Perhaps the issue is the fact that you are running it in a LocalScript. When you change the CollisionGroup on the client, only on the player’s side will they have changed the CollisionGroup, not to the server. To prove this, I made a quick test.

LocalScript

Located in StarterCharacterScripts.

local character = script.Parent

for i, v in character:GetChildren() do
	if v:IsA("BasePart") then
		v.CollisionGroup = "Player"
	end
end

I made a separate CollisionGroup to test, which was a wall in the group ‘Wall’. I was able to walk through the wall as the player, despite the server outputting the following;

image

To the server, I am still in the default CollisionGroup. Hence the server will still tell every other player that my character is in that given group.


To fix this, all you have to do is set the CollisionGroup in a ServerScript, so that every other player will get the signal that my player is in the right group.

ServerScript

Located in ServerScriptService.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	
	player.CharacterAdded:Connect(function(character)
		
		for i, v in character:GetChildren() do
			if v:IsA("BasePart") then
				v.CollisionGroup = "Player"
			end
		end
		
	end)
	
end)

This will accordingly take the player and it’s character, then assign it to the right group. Now it will be the same throughout the entire server, and this script will apply for every player in the game.

it’s a serverscript

i’m pretty sure you can’t modify collisiongroups from localscripts (at least i saw that somewhere)

the collisiongroups change successfully, but the behavior is still odd and not at all what i’m looking for.
i will apply it thru serverscriptservice though, thanks

There is your issue. ServerScripts are prohibited from executing (or even showing) in the StarterPlayer folders.

In fact, you can. I made another quick showcase.

LocalScript

Located in StarterCharacterScripts.

local character = script.Parent

for i, v in character:GetChildren() do
	if v:IsA("BasePart") then
		v.CollisionGroup = "charCollision"
	end
	print("Set Collision")
end

For this result;

Explanation as of why and how this works is in my last post.

that’s odd, i just tried the serverscript implementation but it still hasn’t fixed the issue
but thank you for the info

update: apparently, when grabbing respawned characters (or player characters, respawned or not), the game just… anchors them for no apparent reason??? i can’t find anywhere where it anchors them, so this is really odd
it’s not actually anchoring them but instead is just acting like it is

To fix this issue, you can try moving the LocalScript to a place where it will be executed every time a player spawns or respawns. You can use the PlayerAdded event to detect when a player joins the game and the CharacterAdded event to detect when a character is added (including respawn scenarios). Here’s an example:

local Players = game:GetService("Players")

local function setCollisionGroup(character)
    for _, part in ipairs(character:GetDescendants()) do
        if part:IsA("BasePart") then
            part.CollisionGroup = "Player"
        end
    end
end

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        setCollisionGroup(character)
    end)
end)

By using the PlayerAdded and CharacterAdded events, you ensure that the CollisionGroup is set every time a player joins the game or respawns.

alright so it turns out the issue was actually with welds being janky
i used an alternative method with FireAllClients and a localscript with

local renderstepped = runservice.RenderStepped:Connect(function()
		grabbedpart:PivotTo(grabbingpart.CFrame * CFrame.Angles(math.rad(90),math.rad(0),math.rad(180)) * CFrame.new(0, -0.65, 1.4))
	end)
	task.wait(timelimit)
	renderstepped:Disconnect()

instead of using a weld, and this fixed the issue

1 Like