I’m currently having a problem with teleporting 2 NPCs to a certain position. What I’m trying to do is teleport one NPC to the right side of the player like 4 studs forward, and the same thing for the other NPC but on the other side. It worked fine earlier today, but all of a sudden it just broke. I started experimenting with it, I removed everything from the workspace but the sounds and it worked, then I added them back and removed them again and now it’s completely bugged. I only started modifying the script after doing all of that, so it couldn’t be something to do with the script. (I think?)
I would really appreciate if someone could help me with this (and explain what happened) because I can’t seem to figure this out. Here’s the script:
local plrs = game:GetService("Players")
plrs.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if msg == "you're fatherless" or msg == "You're fatherless" or msg == "fatherless child" then
local chat = game:GetService("Chat")
local ss = game:GetService("ServerStorage")
local fatherFigure = ss:WaitForChild("Father")
local motherFigure = ss:WaitForChild("Mother")
local char = plr.Character
local rootpart = char:WaitForChild("HumanoidRootPart")
rootpart.Anchored = true
wait(3)
workspace.Sounds.arena:Play()
fatherFigure.Parent = workspace
fatherFigure.HumanoidRootPart.CFrame = CFrame.new((rootpart.CFrame.LookVector*15+rootpart.CFrame.RightVector*6),char.Head.Position - Vector3.new(0,3,0)) + Vector3.new(0,2.7,0)
wait(3)
workspace.Sounds.arena2:Play()
motherFigure.Parent = workspace
motherFigure.HumanoidRootPart.CFrame = CFrame.new((rootpart.CFrame.LookVector*15-rootpart.CFrame.RightVector*6),char.Head.Position - Vector3.new(0,3,0)) + Vector3.new(0,2.7,0)
wait(3)
chat:Chat(fatherFigure.Head, "Me and Mother Figure are going to the shop.",Enum.ChatColor.White)
chat:Chat(motherFigure.Head, "Me and Father Figure are going to the shop.",Enum.ChatColor.White)
wait(3)
plr.PlayerGui.GameplayUI.BlackScreen.Visible = true
wait(1.75)
workspace.Sounds["Divine Intervention"]:Play()
plr:Kick("You died because you were a fatherless child 💀")
else
print("Child is not fatherless")
end
end)
end)
There are no errors or anything printed in console, what happens is that the NPCs are not teleporting to the CFrame of my HumanoidRootPart, but they do go to the sides.