Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to respawn a player but it is not working?

Asked by 5 years ago
Edited 5 years ago
--local script

local tool = script.Parent
local localplr = game.Players.LocalPlayer
local mouse = localplr:GetMouse()
local charged = false
local deb = false 
local e = false
local cf = true
mouse.Button1Down:Connect(function()
    if e and mouse.Target ~= nil and mouse.Target.Parent:FindFirstChild("Humanoid") ~= nil then
        local plr = game.Players:FindFirstChild(mouse.Target.Parent.Name)
        if mouse.Target.Parent.Humanoid.Health == 0 and game.Players:FindFirstChild(mouse.Target.Parent.Name) ~= nil then
            script.Parent.Handle.Sound:Play()
            local plrl = mouse.Hit
            wait(26)
            if e then
                local randomnumber = 1
                if randomnumber == 1 and plr.Character.Humanoid.Health == 0 then
                    script.Parent.RespawnPlr:FireServer(plr)
                    repeat
                        wait()
                    until plr.Character ~= nil
                    repeat
                        wait()
                    until plr.Character.Humanoid.Health ~= 0
                    plr.Character.Torso.CFrame = plrl
                    plr.Character.Humanoid.Walkspeed = 0
                    plr.Character.Humanoid.Jumppower = 0
                    wait(script.Parent.Handle.Sound.TimeLength - 26)
                    if randomnumber == 1 then
                        plr.Character.Humanoid.Walkspeed = 16
                        plr.Character.Humanoid.Jumppower = 50
                    end
                end
            end
        end
    end
end)
tool.Equipped:connect(function()
    e = true
end)
tool.Unequipped:connect(function()
    e = false
    script.Parent.Handle.Sound:Stop()
end)
script.Parent:WaitForChild("RespawnPlr")


Si i created this script but if i try on different times the LoadCharacter() that's not working i want to respawn the targeted player? Could anyone help?

0
LoadCharacter only works in the server. User#19524 175 — 5y
0
Ohh so not in a item? So can i try this? And i added a remote event in it but what do i need to put in a normal script in the remoteevent MaxDev_BE 55 — 5y

1 answer

Log in to vote
-1
Answered by
luachef 61
5 years ago
Edited 5 years ago

You can not use :LoadCharacter() on the client. If you want to respawn a player with a tool, you would have to create a remote and fire it, but i do not recommend to do so since exploiters might use it to spam/annoy other players. If you REALLY need it you could add some serversided checks but they might not fully protect you.

0
i's a local script MaxDev_BE 55 — 5y
0
This should be a comment. Also stop copying me. User#19524 175 — 5y
0
I edited it but what do i need to do in the script that i put in the Remote Event RespawnPlr? MaxDev_BE 55 — 5y
0
How exactly am i copying you? LOL luachef 61 — 5y
View all comments (2 more)
0
lau can u help me still? look now at the script and what do i need to place in the remote evnet where i placed a script? MaxDev_BE 55 — 5y
0
??? MaxDev_BE 55 — 5y
Ad

Answer this question