local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("gotothispart")
local function tp(player)
print(player)
workspace.LivingThings:WaitForChild(player).HumanoidRootPart.CFrame = workspace.ToPart.Position + Vector3.new(0,4,0)
print("was tpd")
end
remoteEvent.OnServerEvent:Connect(tp)
I have this script and it breaks when I try to tp the player, I dont see the error though.
You cannot set the CFrame property to a Vector3. So to fix it you need to convert the Vector3 to a CFrame.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("gotothispart")
local function tp(player)
print(player)
workspace.LivingThings:WaitForChild(player).HumanoidRootPart.CFrame = CFrame.new(workspace.ToPart.Position + Vector3.new(0,4,0))
print("was tpd")
end
remoteEvent.OnServerEvent:Connect(tp)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("gotothispart")
local function tp(player)
print(player)
player.Character:PivotTo(workspace.ToPart.CFrame + Vector3.new(0,4,0))
print("was tpd")
end
remoteEvent.OnServerEvent:Connect(tp)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage.gotothispart
local toPart = workspace.ToPart
local function tp(player)
player.Character:PivotTo(toPart:GetPivot() * CFrame.new(0, 4, 0))
end
remoteEvent.OnServerEvent:Connect(tp)