How to fix this teleport script?

Try making the player value:

local playerValue = game.Players.LocalPlayer

1 Like

I did that and now Bring works (it teleports me to the player though) but teleport does not work

Try putting this in the local script:

local playerValue = game.Players.LocalPlayer

local function TeleportTo()
	script.Parent.RemoteEvent:FireServer(playerValue.Character.Torso.CFrame,localValue.Character.Torso.CFrame)
end

local function Bring()
	script.Parent.RemoteEvent:FireServer(localValue.Character.Torso.CFrame,playerValue.Character.Torso.CFrame)
end

script.Parent.To.MouseButton1Down:connect(TeleportTo)
script.Parent.Bring.MouseButton1Click:Connect(Bring)

And what is localValue

localValue = script.Parent.Parent.playerValue.Value

or

local localValue = game.Players.LocalPlayer
local playerValue = script.Parent.Parent.playerValue.Value

I messed up, keep that 2 lines as they are, replace the other

It should be

local localValue = script.Parent.Parent.localValue.Value
local playerValue = game.Players.LocalPlayer
LocalScript
local localValue = game.Players.LocalPlayer
local playerValue = script.Parent.Parent.playerValue.Value

local function TeleportTo()
	script.Parent.RemoteEvent:FireServer(localValue, playerValue)
end

local function Bring()
	script.Parent.RemoteEvent:FireServer(playerValue, localValue)
end

script.Parent.To.MouseButton1Down:connect(TeleportTo)
script.Parent.Bring.MouseButton1Click:Connect(Bring)
Script
script.Parent.RemoteEvent.OnServerEvent:Connect(function(v, t)
	v.Character.Torso.CFrame = t.Character.Torso.CFrame
end)

This way “bring” works as a teleport the one who presses the button to the one in the list where he presses bring. “teleport to” does not work

local localValue = script.Parent.Parent.playerValue.Value
local playerValue = game.Players.LocalPlayer

You mean this? Otherwise there would be two times the same value.

No, the thing that i sent was what i meant.

But then both object would be the same!?

With this “teleport to” works as intended but “bring” does noting.

What is the local value variable for?

localValue = The player who presses. So it’s the LocalPlayer.
playerValue = The playerlist object. All the buttons are inside of the frame belonging to the playerValue. There are exactly so many frames for the list that each player has its own.


Each player has its own Frame.

Oh, well then i see my mistake, it should be this:
I changet it so it is compatible, just put this.

local localValue = script.Parent.Parent.playerValue.Value
local playerValue = game.Players.LocalPlayer

I think only a Script can do this, so I put this part inside of the Script: .Character.Torso.CFrame

Oh my god. Why dont you just listen.

Okay I’ll try it like you told me


But I was right. With your version this is inside of the output and nothing works.

Okay, whatever. Looks like I can’t help you.