Attempt to index nil with 'CFrame'

You only have one solution which is when the player clicks on a button, fire a remotevent, then change the player’s position through a server script:

Make sure to create a remote event inside replicated storage

-- Client(local):
script.Parent.MouseButton1Click:Connect(function()
	game:GetService("ReplicatedStorage").RemoteEvent:FireServer()
end)
--Server:

local part = workspace:WaitForChild("TeleportPart")
game:GetService("ReplicatedStorage").RemoteEvent.OnServerEvent:Connect(function(player)
	local humanoidrootpart = player.Character:WaitForChild("HumanoidRootPart")
	if humanoidrootpart then
		if part then
			humanoidrootpart.CFrame = part.CFrame
		else
			print("TeleportPart does not exist")
		end
	else
		print("HumanoidRootPart Does not exist")
	end
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.