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

NPCs slide across the floor for no reason?

Asked by 4 years ago
Edited 4 years ago

Not sure where to post this... What happens is the NPCs aren't achored and it's supposed to be that way, but even with 0 WalkSpeed they slide across the floor. These NPCs are player clones that are script-created, so I think it might have to do with the script that created them.

game.ReplicatedStorage.AddFriendChar.OnServerEvent:Connect(function(p, clone)
    local charId = p.CharacterAppearanceId
    p.Character.Archivable = true
    p.CharacterAppearanceId = clone.VisitorId
    local user = p.Character:Clone()
    user.Parent = workspace
    user.Name = "User"
    game.ReplicatedStorage.Mic:Clone().Parent = user
    user.HumanoidRootPart.Position = Vector3.new(-15.717, 12.688, -21.785)
    user.HumanoidRootPart.Position = Vector3.new(-15.717, 12.688, -21.785)
    user.HumanoidRootPart.Orientation = Vector3.new(0,0,0)
    --user.HumanoidRootPart.Anchored = true
    user.Humanoid.WalkSpeed = 0
    p:LoadCharacter()
    workspace.LoadedIn.Value = true

    wait(.1)
    p.Character.Archivable = true
    local dupe = p.Character:Clone()
    dupe.Parent = workspace
    dupe.Name = "Enemy"
    dupe.HumanoidRootPart.Position = Vector3.new(-15.717, 12.688, -31.529)
    dupe.HumanoidRootPart.Position = Vector3.new(-15.717, 12.688, -31.529)
    dupe.HumanoidRootPart.Orientation = Vector3.new(0, 180, 0)
    --dupe.HumanoidRootPart.Anchored = true
    dupe.Humanoid.WalkSpeed = 0
    p.CharacterAppearanceId = charId
    p:LoadCharacter()

    for i, v in pairs(workspace:GetChildren()) do
        if v:IsA("Model") and v:FindFirstChild("ForceField") then
            v.ForceField:Destroy()
            v.Humanoid.DisplayDistanceType = "None"
        end
    end
end)

Answer this question