|
| 16 Jan 2014 11:10 PM |
local Humanoid = script.Parent.Human function PwntX_X() local tag = Humanoid:findFirstChild("creator") if tag.Value ~= nil then local Leaderstats = tag.Value.Leaderstats.Gold if Leaderstats ~= nil then Leaderstats.Value = Leaderstats.Value + 1 wait(0.1) script:remove() end end end
Humanoid.Died:connect(PwntX_X)
How dose it get the player? like how could i make it get the player so i could like uhh make it give the player who killed the monster get a gui popup or a tool given to them?
I just don't get how it gets your player or the person who kills it... |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2014 11:13 PM |
i usually tag the killer (like that script) and then untag after it's done adding to the int value, but it doesn't seem like it does it in this script.
This looks like a npc wipe out script
local tag = Humanoid:findFirstChild("creator")
|
|
|
| Report Abuse |
|
|
|
| 16 Jan 2014 11:14 PM |
| for the gui pop-up just clone a gui from lighting or serverstorage to their playergui... if you dont know where playergui is located, play solo mode and explore the explorer (it would be "game.Players.Player1.Playergui") |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Jan 2014 11:16 PM |
| Yes, but can you explain how it works for Npc's / Player's? |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2014 11:18 PM |
| LOL this script removes itself after running |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2014 11:18 PM |
Like um tag = p or w/e..
So you can do: p.PlayerGui.Hi.Frame.Visible = true |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2014 11:19 PM |
| This script is inside an npc right? |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2014 11:19 PM |
| yeah or clone the gui if it is in lighting and not in startergui (putting the gui in lighting and not in starting gui and visibilizing it by cloning it to their guis is more effective for me...) |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2014 11:22 PM |
Yes it is, I'm wanting to know how to accesses the player using it.
like:
local Humanoid = script.Parent.Human
function Hi() local p = Humanoid:findFirstChild("creator") if p ~= nil and p.Value ~= nil then local Guis = p.PlayerGui Gui.Hi.Frame.Visible = true end end
Humanoid.Died:connect(Hi)
|
|
|
| Report Abuse |
|
|
Thaeh
|
  |
| Joined: 05 Feb 2011 |
| Total Posts: 7685 |
|
|
| 16 Jan 2014 11:23 PM |
| creator is an ObjectValue containing the Player |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2014 11:25 PM |
Could i do this?
local Humanoid = script.Parent.Human
function Hi() local p1 = Humanoid:findFirstChild("creator") local p = game.Players:FindFirstChild(p1) local Guis = p.PlayerGui Gui.Hi.Frame.Visible = true end end
Humanoid.Died:connect(Hi) |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2014 11:36 PM |
Well how would i do this??
And yes i know i left a end in there just remove it if your going to use that for testing or w/e.. |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2014 11:42 PM |
| Wiki link anything? No one knows how T_T? Well ok then. >_> |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2014 12:01 AM |
| Anyone know whats wrong with it...? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 Jan 2014 12:02 AM |
| Most weapons add a creator value in a humanoid with the value of the player |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2014 12:04 AM |
yes... but it isn't a player :l It's an Npc. T_T |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 Jan 2014 12:06 AM |
-.- It's not going to be a player either way, since they don't have Humanoids (nor "Humans" in them) because only characters do. And either way, most weapons create the value in Humanoid, so if that's not found then it's not going to add a value, so this is useless. Otherwise the weapon will just create an object value called "creator" in Humanoid and set the value to the Player who has the weapon (NOT the character) |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2014 12:08 AM |
| uhh... the humanoid in the npc is called human.. >_< |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 Jan 2014 12:09 AM |
| Exactly, and weapons look for "Humanoid" not "Human" so if you are using a regular weapon/free model then this is not going to work since the weapon is not going to add a creator value |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2014 12:11 AM |
| Uhh.. the weapon kills it but it dosen't open the gui.. :l |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 Jan 2014 12:13 AM |
| I just told you why, three times |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2014 12:15 AM |
You said it was cause the sword but it works fine with this script...
local Humanoid = script.Parent.Human function PwntX_X() local tag = Humanoid:findFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then local Leaderstats = tag.Value.leaderstats if Leaderstats ~= nil then Leaderstats.Value = Leaderstats.Value + 1 wait(0.1) script:remove() end end end end Humanoid.Died:connect(PwntX_X) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 Jan 2014 12:17 AM |
So I'm assuming you edited the sword to find "Human." In that case, the problem is obvious. Try this
local Humanoid = script.Parent.Human function PwntX_X() local tag = Humanoid:FindFirstChild("creator") if tag and tag.Value then local Leaderstats = tag.Value:FindFirstChild("leaderstats") and tag.Value.leaderstats:FindFirstChild("Gold") if Leaderstats ~= nil then Leaderstats.Value = Leaderstats.Value + 1 wait(0.1) script:remove() end end end
Humanoid.Died:connect(PwntX_X) |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2014 12:32 AM |
ok that works but uhh how dose this work??
local Humanoid = script.Parent.Human
function Hi() local p1 = Humanoid:findFirstChild("creator") local p = game.Players:FindFirstChild(p1) local Guis = p.PlayerGui Gui.Hi.Frame.Visible = true end
Humanoid.Died:connect(Hi) |
|
|
| Report Abuse |
|
|