--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?
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.