I’m trying to create a bring command that bring the given name that is typed in the command bar. It does bring the typed player and all that, but when that brought player dies, their body is put back to where they were before they were brought.
Here’s my Local Script:
local players = game:GetService("Players")
local player = players.LocalPlayer
local char = player.Character
local Remote = game:GetService("ReplicatedStorage").BringRemote
local playerusernamebox = script.Parent.Parent:WaitForChild("PlayerUsername")
script.Parent.MouseButton1Up:Connect(function()
local playerToBring = playerusernamebox.Text
local Searchplayer = game.Workspace:FindFirstChild(playerToBring)
if Searchplayer then
local playerToBringHRP = Searchplayer:WaitForChild("HumanoidRootPart")
Remote:FireServer(playerToBringHRP)
end
end)
and here’s my server script:
local Remote = game:GetService("ReplicatedStorage").BringRemote
Remote.OnServerEvent:Connect(function(plr, playerToBringHRP)
local CallerChar = plr.Character
local CallingCharHRP = plr.Character:WaitForChild("HumanoidRootPart")
if plr and CallingCharHRP and playerToBringHRP then
playerToBringHRP.CFrame.Position = CallingCharHRP.CFrame.Position
playerToBringHRP.Origin.Position = CallingCharHRP.Origin.Position
print("Successfully brought " .. playerToBringHRP.Parent.Name .. " to " .. plr.Name)
end
end)
and yes, I did get errors saying that Position isn’t valid and that origin isn’t valid (I need help on that as well please.)
Please help, thanks!