NPC Launches on spawn while moving

You can write your topic however you want, but you need to answer these questions:

  1. I want to spawn NPC behind the player once clicked on npc. Example:
    Works.wmv (255.4 KB)
  2. If player is moving and player clicks on NPC, NPC launches into space. Example:
    NOTWORK.wmv (685.1 KB)
  3. I have tried anchoring npc but once i unanchore npc still launches

Here is the script once clicked on NPC it fires this event

game.ReplicatedStorage.Events.Clicked.OnServerEvent:Connect(function(player, NPC, Object)
		NPC.PrimaryPart:PivotTo(Find_Player_Tycoon(player).HumanoidRootPart.CFrame *,1,3))
		NPC.Humanoid.PlatformStand = false
		player.Inventory.Value -= 1
		Fix_Inventory_Height(Char, NPC:GetAttribute("Inventory_Height") ,player)
		NPC.Parent = Find_Player_Tycoon(player)

Thanks in advance!

I think you are moving it with the wrong tools, setting the CFrame of the HRP (or whatever the main part of the NPC is) directly is probably the best way of setting their position

Also you are moving the pivot of only one part of the model, if you want to use pivotto it might work if you apply it to the model instead of one of its children,

1 Like

Um if I understood you right: I have tried few changes
First try, yet still the same result

NPC:PivotTo(Find_Player_Tycoon(player).HumanoidRootPart.CFrame *,1,3))

Second try, also same result

NPC.PrimaryPart.CFrame = Find_Player_Tycoon(player).HumanoidRootPart.CFrame *,1,3)

It doesn’t work unless I haven’t understood you right

what is"Find_Player_Tycoon" doing? i dont think thats necessary
try doing player.character.HumanoidRootPart instead of Find_Player_Tycoon(player).HumanoidRootPart.CFrame

Find_Player_Tycoon as its name says finds fake humanoid inside players owned tycoon part where all the npcs are stored.

local function Find_Player_Tycoon(player)
	for _, Tycoon in pairs(workspace:GetChildren()) do
		if Tycoon.Name == "Tycoon" and Tycoon:GetAttribute("Owner") == player.Name then
			return Tycoon

I have just tried the code you suggested but it still has the same outcome, is there away to stop that momentum and why dose it even happen?

if you make the fake part visible is it being weird? The cframe shouldnt be shooting off the npcs on its own

That fake part is storage for npcs, fake part is copy of humanoidrootpart and it’s welded to the real humanoidrootpart, i have done it so i would be able to detect npcs on the player’s back, and that part shouldn’t shoot npcs

I found a way to fix it, all I needed is to just change velocity

NPC.PrimaryPart.Velocity =

Thanks for helping me

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.