|
| 25 May 2017 02:58 AM |
| For example, You die and your character disappears.. How do i do that? |
|
|
| Report Abuse |
|
|
|
| 25 May 2017 03:44 AM |
--Local script inside of starter pack.
local plr = game.Players.LocalPlayer local chr = game.Workspace:WaitForChild(plr.Name) local hum = chr:WaitForChild("Humanoid")
hum.Died:connect(function() chr:Destroy() end)
That should do it, can't check it. |
|
|
| Report Abuse |
|
|
|
| 25 May 2017 03:47 AM |
You should use a server script (regular 'Script' object) for this in order to ensure FE compatibility. To make this apply to all characters, do the following:
-- Script in ServerScriptService
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) Character.Humanoid.Died:Connect(function() wait(1) -- So it doesn't immediately disappear? Character:Destroy() end) end) end)
|
|
|
| Report Abuse |
|
|
|
| 25 May 2017 05:00 AM |
wait()if script.Parent.className~='Model'then script.Parent=Game.StarterPlayer.StarterCharacterScripts for i,v in pairs(Workspace:GetChildren())do if Game:service'Players':getPlayerFromCharacter(v)then Game:service'Players':getPlayerFromCharacter(v):LoadCharacter() end end else script.Parent.Humanoid.Died:connect(function()wait()script.Parent:destroy() end) end |
|
|
| Report Abuse |
|
|
LaeMVP
|
  |
| Joined: 24 Jun 2013 |
| Total Posts: 4416 |
|
|
| 25 May 2017 05:08 AM |
| Can anyone else spot the 4 deprecated functions in his script? |
|
|
| Report Abuse |
|
|
| |
|
|
| 25 May 2017 11:57 AM |
| SirC's is much more efficient than what I posted and sets up a stronger framework. I'd advise you use that. |
|
|
| Report Abuse |
|
|
|
| 25 May 2017 12:00 PM |
Or instead of connecting another event:
Character.Humanoid.Died:Wait() Character:Destroy()
|
|
|
| Report Abuse |
|
|