I have a remote that will teleport a player to another player. Here is the script
script.Parent.OnServerEvent:Connect(function(_, tp1, tp2) function shortenName(name) local ReturnedName for i,v in pairs(game.Players:GetPlayers()) do if v.Name:sub(1,name:len()):lower()== name:lower() then ReturnedName = v.Name end end return ReturnedName end tp1 = shortenName(tp1) tp2 = shortenName(tp2) workspace[tp1].HumanoidRootPart.Position = workspace[tp2].HumanoidRootPart.Position end)
Here is my localscript
script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Parent.Remotes.tp:FireServer(script.Parent.Parent.Parent.player.Text, game.Players.LocalPlayer.Name) end)
The error: Players.7izr.PlayerGui.PlayerGui.gui.Remotes.tp.Script:13: bad argument #2 (string expected, got nil)
I have since fixed it. Its getting the list of children in game.Players but im trying to teleport a dummy that is not in game.Players