Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I made a teleporting device, says I need a vector3?

I tried making a tool that would teleport the player.

LocalScript:

local plr = game.Players.LocalPlayer

script.Parent.Activated:Connect(function()
	local mouse = plr:GetMouse() 
	game.ReplicatedStorage.tpPlr:FireServer(mouse.Hit.p)
end)

server script:

game.ReplicatedStorage.tpPlr.OnServerEvent:Connect(function(client, mouseCFrame)
	local humanPart = client.Character.HumanoidRootPart
	humanPart.CFrame = mouseCFrame 
end)

It said that a CFrame was expected, but got a Vector3. Anyone know the problem?

1 answer

✓ Accepted answer

I recommend Using :MoveTo() as the player is a model and this ensures the player does not fall through the ground without any extra code here is an example of how to use it.

game.ReplicatedStorage.tpPlr.OnServerEvent:Connect(function(client, mouseCFrame)
    local Character = workspace:WaitForChild(client.Name)
    Character:MoveTo(mouseCFrame)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.