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 » Scripting Helpers
Home Search
 

Re: I'm curious as to how this works.

Previous Thread :: Next Thread 
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
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
alexthemongolian is not online. alexthemongolian
Joined: 23 Mar 2011
Total Posts: 655
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
Drybones3363 is not online. Drybones3363
Joined: 16 Aug 2013
Total Posts: 1547
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
alexthemongolian is not online. alexthemongolian
Joined: 23 Mar 2011
Total Posts: 655
16 Jan 2014 11:15 PM
solo mode sucks
Report Abuse
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
16 Jan 2014 11:16 PM
Yes, but can you explain how it works for Npc's / Player's?
Report Abuse
alexthemongolian is not online. alexthemongolian
Joined: 23 Mar 2011
Total Posts: 655
16 Jan 2014 11:18 PM
LOL this script removes itself after running
Report Abuse
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
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
alexthemongolian is not online. alexthemongolian
Joined: 23 Mar 2011
Total Posts: 655
16 Jan 2014 11:19 PM
This script is inside an npc right?
Report Abuse
Drybones3363 is not online. Drybones3363
Joined: 16 Aug 2013
Total Posts: 1547
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
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
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 is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
16 Jan 2014 11:23 PM
creator is an ObjectValue containing the Player
Report Abuse
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
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
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
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
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
16 Jan 2014 11:42 PM
Wiki link anything? No one knows how T_T? Well ok then. >_>
Report Abuse
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
17 Jan 2014 12:01 AM
Anyone know whats wrong with it...?
Report Abuse
cntkillme is not online. 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
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
17 Jan 2014 12:04 AM
yes... but it isn't a player :l
It's an Npc. T_T
Report Abuse
cntkillme is not online. 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
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
17 Jan 2014 12:08 AM
uhh... the humanoid in the npc is called human.. >_<
Report Abuse
cntkillme is not online. 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
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
17 Jan 2014 12:11 AM
Uhh.. the weapon kills it but it dosen't open the gui.. :l
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 Jan 2014 12:13 AM
I just told you why, three times
Report Abuse
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
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 is not online. 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
ServerStorage is not online. ServerStorage
Joined: 03 Oct 2013
Total Posts: 111
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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