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

Why is my CollisionGroup setup not working?

Asked by 3 years ago

I have a monster in my game that causes the player to play a "sinking into ground" animation when it touches them. The problem is, my animation stops in the middle of playing due to collisions. To fix this, I put the player in its own collision group during the animation. But my script/setup won't do anything. Here it is:

-- Before animation

local p1 = "Player1" local p2 = "Player2" local def = "Default"

PhysicsService:CollisionGroupSetCollidable(p1, def, true) PhysicsService:CollisionGroupSetCollidable(p2, def, false)

PhysicsService:SetPartCollisionGroup(player.Head, p2) PhysicsService:SetPartCollisionGroup(player.Torso, p2) PhysicsService:SetPartCollisionGroup(player.HumanoidRootPart, p2) PhysicsService:SetPartCollisionGroup(player["Left Arm"], p2) PhysicsService:SetPartCollisionGroup(player["Right Arm"], p2) PhysicsService:SetPartCollisionGroup(player["Left Leg"], p2) PhysicsService:SetPartCollisionGroup(player["Right Leg"], p2)

-- During animation

player.Animate.Disabled = true

script:WaitForChild("anim") humananim:Play() humananim.Looped = false

-- After animation

PhysicsService:SetPartCollisionGroup(player.Head, p1) PhysicsService:SetPartCollisionGroup(player.Torso, p1) PhysicsService:SetPartCollisionGroup(player.HumanoidRootPart, p1) PhysicsService:SetPartCollisionGroup(player["Left Arm"], p1) PhysicsService:SetPartCollisionGroup(player["Right Arm"], p1) PhysicsService:SetPartCollisionGroup(player["Left Leg"], p1) PhysicsService:SetPartCollisionGroup(player["Right Leg"], p1)

player.Animate.Disabled = false

wait(3) hum.Health = 0

cop.Killer.WalkSpeed = 16

Answer this question