Why player no teleport

My mind is broken
The player used to teleport, now it just doesn’t…
What did I do wrong here?´

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LocalPlayer = Players.LocalPlayer
local function tp()
	local Character = LocalPlayer.Character
	if Character then
		local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
		if HumanoidRootPart then
			HumanoidRootPart.CFrame = workspace.PlayerNewPos.CFrame
			HumanoidRootPart.CFrame = CFrame.lookAt(HumanoidRootPart.Position, workspace.PlayerNewDir.Position)
		end
	end
end
ReplicatedStorage.Events.Start.OnClientEvent:Connect(tp)

I’m still a newbie, so don’t be surprised if the answer is so simple
Here’s the thing if you wanna have a look
FlappyBird.rbxl (85.3 KB)

1 Like

if this doesn’t work could you send any errors in the console?

this changes the local Character to wait for the character to spawn

Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()

Uh could you format that? Thanks.

Nothing happened

Small note: I’d prefer if you people had a look into the whole thing

Btw @VexByx nothing happened in the output

A bit unrelated but rather than doing this:

Just do this:

HumanoidRootPart.CFrame = CFrame.new(workspace.PlayerNewPos.Position,workspace.PlayerNewDir.Position)
1 Like

Change the code in ServerToClientEventReverser to

--Naming convention: onX, X being the event name
local function onEnd(client, toReverse) -- original: onEnd(toReverse)
	if toReverse == true then
		Eend:FireClient(client, false) -- original: Eend:FireClient(false)
	end
end
local function onStart(client, toReverse) -- original: onStart(toReverse)
	if toReverse == true then
		Estart:FireClient(client, false) -- original: Estart:FireClient(false)
	end
end

--Connections!
Eend.OnServerEvent:Connect(onEnd)
Estart.OnServerEvent:Connect(onStart)

your code doesnt accound for the fact that remoteevents sent from the client to the server have a parameter for which player sent it.

Still no teleport sadly

It… works perfectly fine for me. Can I see what your code looks like?

for reference, here is what it looks like on my end without the changes

It just… doesn’t work

yeah try this code here

you can see in the video above where i replaced the code

JESUS CHRIST THANK YOU IT WORKED
Looks like I copy pasted it in the wrong way :person_shrugging:

1 Like

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