i made group for players and npcs and it works in studio (player cant collide with npc) but in game it not working (player CAN collide with npc)
Scottifly
(Scottifly)
September 30, 2022, 5:23am
#2
There is a section here for Disabling Character Collisions: Collision Filtering | Roblox Creator Documentation
I’m not sure if it helps with NPCs though.
Here are a few forum posts I found with the Search tool:
Sorry for bumping, but that code works, if you add a (task.) wait(0.5) after the character is added.
So like this:
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
task.wait(0.5) -- or wait()
for i, instance in pairs(character:GetDescendants()) do
if instance:IsA("BasePart") then -- why even using IsA(Part)? A Base Part holds all Types of Parts (Mesh,Part,etc.)
PhysicsService:SetPartCollisionGroup(instance, "Players")
end
end
…
I want to make it so that the NPC is not able to collide with players. I checked out the articles at https://developer.roblox.com/ . I couldn’t find a tutorial for NPCs and Players. I only found how to stop collisions of players to other players using PhysicsService.
I tried to try to make some changes and make it work with NPCs and Players but it doesn’t works. I can still touch the NPC and push it.
Here is the code I managed to come up with.
local phys = game:GetService("PhysicsService")
loc…
I’ve been trying to make my NPCs to stop colliding with the player’s characters in-game.
I’ve tried using physics service, but that didn’t work. Here is the code for the physics service script, please help, and thanks!
local PS = game:GetService("PhysicsService")
PS:CreateCollisionGroup("Player")
PS:CollisionGroupSetCollidable("Player","Player",false)
PS:CreateCollisionGroup("NPC")
PS:CollisionGroupSetCollidable("NPC","NPC",false)
PS:CollisionGroupSetCollidable("NPC","Player",false)
game.Pla…
Issue: I have a carry system in my game where you can carry players and NPCs. and it throws them over your shoulder. Only problem is that when you are carrying a player the carried player can still collide with the environment. Meaning you cannot fit through certain doorways while carrying a player or climb onto walls which is another feature in my game.
How can I make it so whenever I carry a player they cannot collide with the world around them so I can actually get through stuff? Player coll…
It sometimes works but sometimes not
Scottifly
(Scottifly)
October 1, 2022, 4:12am
#4
If it’s only working sometimes then it’s likely in your scripting.
Try posting the script you use so others can see it here and try to help.
Also, check to see if using a LocalScript or server Script makes a difference. Local scripts are only done on your computer, so often in Studio they work because everything is done there, but in game they work on Roblox’s servers so local scripts won’t do the same job.
Scottifly
(Scottifly)
October 1, 2022, 9:49am
#6
Well since players don’t exist in the game until they are added you have to script them, just like in every link I posted above…
2 Likes