So I have a script that works perfectly fine with any other player on both sides, except me on the right. What should happen is that the localscript gets the localplayer teleport data and checks to see if the players name is in the first or second slot of the table. If it finds the player in the left slot, it fires the server with a string with the side name and then teleports the player.
What I don’t understand is that the script doesn’t work with my player for some reason. It will only work on the right side and not the left. It is really strange.
local:
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playersInGame = TeleportService:GetLocalPlayerTeleportData()
if playersInGame then
if playersInGame[1] == player.Name then
game.ReplicatedStorage.PlayerPlacement:FireServer("Left")
elseif playersInGame[2] == player.Name then
game.ReplicatedStorage.PlayerPlacement:FireServer("Right")
end
end
server:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
ReplicatedStorage.PlayerPlacement.OnServerEvent:Connect(function(plr, side)
local char = plr.Character or plr.CharacterAdded:Wait()
if side == "Left" then
local HRP = char:WaitForChild("HumanoidRootPart")
HRP.CFrame = CFrame.new(31.65, 10, 358.571)
elseif side == "Right" then
local HRP = char:WaitForChild("HumanoidRootPart")
HRP.CFrame = CFrame.new(2.493, 10, 358.571)
end
end)