✓ Accepted answer
Using the Humanoid for :MoveTo(), I wouldn't use as it causes it to walk instead of actually teleport. Instead, target the Model. As it will provide the PrimaryPart, which should be the Instance passed to teleporting
So to solve your issue, this is what your Script should look like
local CoordianteFrame = workspace:WaitForChild("Location1").CFrame
local UserInputService = game:GetService("UserInputService")
local Char = workspace:WaitForChild("NPC")
UserInputService.InputBegan:Connect(function(InputObject, GameProcessed)
pcall(function()
if (InputObject.KeyCode == Enum.KeyCode.E and not GameProcessed) then
if (Char:FindFirstChild("Humanoid"):IsA("Humanoid")) then
Char:MoveTo(CoordianteFrame.Position)
return
end
print(Char.Name.." doesn't have a Humanoid.")
end
end)
end)
Hope this sends you in the right direction, I suggest reading about :MoveTo() to get a better grasp, also UserInputService may be new to you, so check out UserInputSerivce when you can. Good Luck! lots have changed in this past year.
1 comment
You're all good to go!