Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Could not create Collision Group. Why?

Asked by 7 years ago

In my game, I have a gun which throws out shells when it fires. What I want is the shells to not collide with players. I have this script:

01local PhysicsService = game:GetService('PhysicsService')
02 
03local ShellGroup = "ShellGroup"
04local PlayersGroup = "PlayersGroup"
05print(script.Parent.Name)
06PhysicsService:CreateCollisionGroup(ShellGroup)
07PhysicsService:CreateCollisionGroup(PlayersGroup)
08 
09PhysicsService:CollisionGroupSetCollidable('ShellGroup','PlayersGroup',false)
10 
11local shell = script.Parent
12local character = game.Players.LocalPlayer.Character --the player's character
13 
14PhysicsService:SetPartCollisionGroup(shell,'ShellGroup')
15 
View all 21 lines...

This is in a LocalScript, I tried a Script too, but it has the same result; the output is: "Could not create Collision Group." at line 6.

This script is disabled in the tool. When the main script generates the shells, it :Clone()s it and sets itsDisabled to false. Then it sets the script's Parent to the shell. These shells are in the script which generates them, which is inside the tool, which is inside the player's character. I tried to put the shells into a different parent, but there's no difference.

Also, before I tried to make the script just turn the shell's CanCollide property off when they are on the ground, but I need something better than that.

I have no idea whats wrong, some pls help?

1
First of all it must be inside a Script, it's the server to call those function, not the client. Also try to put it inside the ServerScriptService, but it's strange it should work. Mmhh, do what I say and if it doesn't work I'll figure it out. alessandro112 161 — 7y
0
I will try your suggestion when I have some more time. Thank you :D RiskoZoSlovenska 378 — 7y

Answer this question