generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

detect if specific player died?

Previous Thread :: Next Thread 
nowihaveyou is not online. nowihaveyou
Joined: 08 Apr 2009
Total Posts: 39093
10 Oct 2016 09:50 PM
im trying to detect if when i die (just me, not "i" as in the player)

it'll take a brick out of ServerStorage and remove it 10 seconds later

can you help me see where i'm wrong?


function GetPlayer(p)
function OnDied()
local x = game.ServerStorage:findFirstChild("nowihaveyouDeath"):clone()
x.Parent = game.Workspace
wait(10)
game.Workspace.nowihaveyouDeath:Destroy()
end

p.Character.Humanoid.Died:connect(OnDied)

end

game.Players.nowihaveyou.PlayerAdded:connect(GetPlayer)





Report Abuse
textartotoboy2 is not online. textartotoboy2
Joined: 24 Jul 2012
Total Posts: 368
10 Oct 2016 09:53 PM
Instead of:


local x = game.ServerStorage:findFirstChild("nowihaveyouDeath"):clone()
x.Parent = game.Workspace
wait(10)
game.Workspace.nowihaveyouDeath:Destroy()


Use:

local x = game.ServerStorage:findFirstChild("nowihaveyouDeath"):clone()
x.Parent = game.Workspace
wait(10)
game:GetService('Debris"):AddItem(x,10) <----- Ads the brick to workspace, then removes it after 10 seconds.

Mind if you post the output?
Report Abuse
nowihaveyou is not online. nowihaveyou
Joined: 08 Apr 2009
Total Posts: 39093
10 Oct 2016 09:59 PM
sure I changed it as you recommended so the final script is now

function GetPlayer(p)
function OnDied()
local x = game.ServerStorage:findFirstChild("nowihaveyouDeath"):clone()
x.Parent = game.Workspace
wait(10)
game:GetService("Debris"):AddItem(x,10)
end

p.Character.Humanoid.Died:connect(OnDied)

end

game.Players.nowihaveyou.PlayerAdded:connect(GetPlayer)


the output only mentions line 15

22:58:00.706 - Stack Begin
22:58:00.706 - Script 'Workspace.Script', Line 15
22:58:00.707 - Stack End
Report Abuse
textartotoboy2 is not online. textartotoboy2
Joined: 24 Jul 2012
Total Posts: 368
10 Oct 2016 10:07 PM
Make a ModuleScript, place it in workspace. In the Module script, copy and paste this code: local module = {} module.Died = ####################### ########################## "Has died!") end return module Make a Regular Script. Place it in StarterPlayers > StarterCharacterScripts In the regular script, copy and paste this code: local Module = require(game.workspace.ModuleScript) ############################################## Module.Died(script.Parent) end) This is the easiest way for me. Hope it works!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image