I just write script that teleport player to “a” object in workspace but my code not working
{
KeyCode = Enum.KeyCode.E;
Description = 'Teleport';
Function = function()
local Teleport = "a"
if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true --Checks Debounce.
local Pos = script.Parent.Parent:findFirstChild(Teleport) --Gets the Part to teleport to.
moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false end end
};
{
place = CFrame.new(0,0,0) -- Where you want the player to go on touched
script.Parent.Touched:connect(function(p)--Creating the function
local humanoid = p.Parent:findFirstChild("Humanoid")--Trying to find the humanoid
if (humanoid ~= nil) then -- Checking if what touched it IS a player.
humanoid.HumanoidRootPart.CFrame = place -- Moves the torso to what is specified in the place variable
end
end
But now getting this error on console
HumanoidRootPart is not a valid member of Humanoid "Workspace.Sarptra.Humanoid" - Client - Interaction:10
17:28:13.424 Stack Begin - Studio
17:28:13.425 Script 'Workspace.AllInteractions.TestInteraction.Interaction', Line 10 - Studio - Interaction:10
HumanoidRootPart is not a valid member of Model "Workspace.Sarptra" - Client - Interaction:10
17:32:15.107 Stack Begin - Studio
17:32:15.108 Script 'Workspace.AllInteractions.TestInteraction.Interaction', Line 10 - Studio - Interaction:10
17:32:15.109 Stack End