Im only a beginner at scripting and I have no idea how teleporting something that contains a Humanoid works.
I tried moving the torso, the humanoid, using moveto? (i dug around in some free models to try to salvage that) and i cant seem to do it.
Im just very lost, and I feel like the answer is simple. Anywhere anyone can point me?
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") --// Random Event fire. 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 --// Same principles 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.
To teleport something with a humanoid, you need to change the CFrame value.
workspace.NPC.PrimaryPart.CFrame = CFrame.new(x, y, z)
x, y, and z are the coordinates of the destination.
Hope this helps