local p = game.Players:FindFirstChild(name.Text)
local c = p.Character
local h = c.Humanoid
local res = game.ReplicatedStorage.Respawn.MainScript
res.Parent = game.Workspace
h.Health = 0
wait(0.001)
res.Parent = game.ReplicatedStorage
I wanted create reload player character script but it brokes and only kills player?
3 answers
GENERAL PRACTICE
Use workspace instead of game.Workspace
Don't use :FindFirstChild() to get a player from Players since if an object with the same name as a player was added to the service, it may be picked instead.
Use :WaitForChild() to make sure a part exists before changing / using it
ISSUES
You can use the :LoadCharacter() function of a player to make them respawn without the need to die, however this must be done in a Server Script.
Since you are using a LocalScript, you will require a RemoteEvent
NOTES
Your example script doesn't list the local "name" variable so you will have to add this, along with its functional connection to the script.
REVISED LocalScript (Change your above code to this, keeping your connection / name variable)
local remote = game:GetService("ReplicatedStorage"):WaitForChild("RespawnPlayer")
local res = game:GetService("ReplicatedStorage"):WaitForChild("Respawn"):WaitForChild("MainScript")
res.Parent = workspace
remote:FireServer(name.Text)
wait(0.001)
res.Parent = game:GetService("ReplicatedStorage")
REVISED Server Script (Add this under ServerScriptService)
local remote = Instance.new("RemoteEvent")
remote.Name = "RespawnPlayer"
remote.Parent = game:GetService("ReplicatedStorage")
remote.OnServerEvent:Connect(function(p)
p:LoadCharacter()
end)
Use :LoadCharacter()
local Player = game.Players:FindFirstChild(name.Text)
--Before this line you should add an event like Button.MouseButton1Click
Player:LoadCharacter()
2 comments
17:06:09.255 - LoadCharacter can only be called by the backend server
that means it's meant to go in a server sided script, if you want to do this from the client you can set up a remote event that tells the server to do it for you
Hello! If you want to respawn a player instantly use :LoadCharacter() instead of Humanoid.Health = 0. Here is an example:
wait(10)
game.Players.JakyeRU:LoadCharacter()
-- My character will be respawned after 10 seconds.
EDIT: You can only use the :LoadCharacter() from a Server Script. If you want to use it from a LocalScript then you have to use RemoteEvents.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Please help me, thanks.
what u trying to do
You can use https://developer.roblox.com/api-reference/function/Player/LoadCharacter to reload the players character