This is just a simple teleport script. It works fine, but when a non-humanoid model touches it then it gives this err:
Humanoid is not a valid member of Folder “Workspace.HubParts”
How do I stop this error from happening? It doesn’t affect performance, but it is cluttering up my Output page.
Here is the script:
local Pad2 = game.Workspace.Teleporters.TeleporterY
script.Parent.Touched:Connect(function(touchpart)
if touchpart and touchpart.Parent and touchpart.Parent.Humanoid and touchpart.Parent.CT.Value == false then
local character = touchpart.Parent
local location = CFrame.new(Pad2.CFrame.X, Pad2.CFrame.Y+3, Pad2.CFrame.Z)
character:SetPrimaryPartCFrame(location)
local televalue = character.CT
televalue.Value = true
wait(3)
televalue.Value = false
end
end)