Hey! So a couple of weeks ago I made this NPC. I realized later that people are able to push the NPC into the lava. So my question is how do I stop this? I would like the NPC to stop being pushed by either making players walk through it or make it like a rock, where you can’t push it at all. I tried turning collisions off for the body parts, but nothing happened.
You need to make the npc collide…
but probably if i’m right you did say that and it didn’t do anything so if it did fell trough the map make the feets of the NPC not collide so he will stand.
if that all doesn’t work try it with a script it’s not really hard but i don’t think if the previous one didn’t work this will work.
If you want the NPC not to move and just stay still, put the anchored activated, so that way they won’t be able to move it.
Ye but then you can’t play animations so you can’t do that and the NPC it self will also not be able to walk.
I understand that, but that depends on whether the creator wants to put animations on it, or not, it could be a shop or a helping NPC.
i think you MIGHT be able to play animations on anchored NPCs?
Don’t think you can…
I’ve tried before and failed
I added a weld to the NPC and put it on the baseplate and that worked for me. Let me know if it works for you
Will that make the npc be able to move? Because mine moves around.
Yes I have an NPC that walks around.
It wouldn’t work if it walks around, but it does if it has the idle animation
Anchor it lol, The NPC CAN still talk because the anchor only applies to the humanoid, I don’t see why you need to have it animated but if so just use can collide or place the NPC On a different object rather than the floor and you can set the transparencey to 1.
Anchor the HumanoidRootPart! That usually fixes it without any crazy solutions or code!
I joined the game and realized that your NPC moves, there is solution off the top of my head that I know.
This script was created by Roblox back then when the Jurassic World event was active. Try inserting this script into your NPC.
I’m unable to find the original Roblox model…
-- Roblox services
local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")
local npcModel = script.Parent
local playerGroup = "Players"
local npcGroup = "NPCs"
local function collisionGroupExists(groupName)
local groups = PhysicsService:GetCollisionGroups()
for _, group in ipairs(groups) do
if group.name == groupName then
return true
end
end
return false
end
if not collisionGroupExists(npcGroup) then
PhysicsService:CreateCollisionGroup(npcGroup)
end
if not collisionGroupExists(playerGroup) then
PhysicsService:CreateCollisionGroup(playerGroup)
end
PhysicsService:CollisionGroupSetCollidable(npcGroup, playerGroup, false)
local function setCollisionGroupRecursive(object, group)
if object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(object, group)
end
for _, child in ipairs(object:GetChildren()) do
setCollisionGroupRecursive(child, group)
end
end
local function onCharacterAdded(character)
setCollisionGroupRecursive(character, playerGroup)
character.DescendantAdded:Connect(function(descendant)
if descendant:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(descendant, playerGroup)
end
end)
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
end
setCollisionGroupRecursive(npcModel, npcGroup)
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in ipairs(Players:GetPlayers()) do
onPlayerAdded(player)
end
also is it supposed to randomly walk around or does it have a certain path
It has a certain path that it follows.
If I anchor it, the NPC won’t be able to move around, which defeats the whole purpose of this post.
So this works, but it turns the collisions of the players back on. We already had a script that turns collisions off for players, and this is not the case anymore.
Make another collision group solely for NPCs and set the players’ collision group to not be able to collide with the NPC group.
On an off note, this probably belongs more in #help-and-feedback:scripting-support.
How would I do this in the script? Sorry for asking but I only know the basics of scripting.
If you post the script it will be easier to help.