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
 

Re: HOW DO I READ THESE DARN CREATOR TAGS

Previous Thread :: Next Thread 
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
28 Jul 2016 09:46 PM
--Variables:
local figure1 = game.Workspace:WaitForChild("Figure")
local humanoid1 = figure1:WaitForChild("Humanoid")
local figure2 = figure1.Parent:WaitForChild("Figure2")
local humanoid2 = figure2:WaitForChild("Humanoid")
--
game.Workspace.ChildAdded:connect(function(child) --Since the NPCs respawn, this will check for their new models and change figure1 and figure2 to the new model.
if child.Name == "Figure" then
figure1 = child
humanoid1 = child:WaitForChild("Humanoid")
elseif child.Name == "Figure2" then
figure2 = child
humanoid2 = child:WaitForChild("Humanoid")
end
end)

humanoid1.Changed:connect(function(c)--When figure1's humanoid is changed,
if c == "Health" then --If that change was its health then
if humanoid1:FindFirstChild("creator") ~= nil then--Check if it has a value named "creator" in it. The sword makes a value go inside the humanoid stating who hit it. :)
local value = humanoid1.creator.Value
print(value)
local playerchar = game.Workspace:WaitForChild(value)--Find the person's character of the value who said who hit it.
local torso = playerchar.Torso--Get that person's torso.
humanoid2:MoveTo(torso.Position)--Make figure2 walk to their torso position! (This will make it so it walks to the player by the way)
playerchar.Humanoid:TakeDamage(10)--After the player has been reached, inflict damage!
end
end
end)

Every time I go to read the tag it keeps erroring that what I'm looking for is nil.

I feel like I'm reading the tags wrong- Am I?

u sicko!
Report Abuse
AlexanderLua is not online. AlexanderLua
Joined: 08 May 2015
Total Posts: 92
28 Jul 2016 09:51 PM
Does the print(value) work? It should, but if not print(value.Name)

local playerchar = game.Workspace:WaitForChild(value.Name)
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
28 Jul 2016 10:09 PM
IT PRINTS MY NAME, YET IT SAYS IT IS NIL
WHY

u sicko!
Report Abuse
AlexanderLua is not online. AlexanderLua
Joined: 08 May 2015
Total Posts: 92
28 Jul 2016 10:14 PM
FindFirstChild() is looking for a string, not a Player object.
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
28 Jul 2016 10:16 PM
How do I get the player then?

u sicko!
Report Abuse
killerbot29003 is not online. killerbot29003
Joined: 04 Oct 2014
Total Posts: 3054
28 Jul 2016 10:21 PM
player.Name



This siggy is copyrighted ©
Report Abuse
AlexanderLua is not online. AlexanderLua
Joined: 08 May 2015
Total Posts: 92
28 Jul 2016 10:22 PM
Hmm, I must be missing something.
I assume that the "creator" tag is an ObjectValue named "creator", right?
So either the ObjectValue is never being inserted into the humanoid, or its Value is never being assigned. If you already checked both then I'm just as confused as you are. Also, I have run into problems with :WaitForChild() in the past, it may be better to use something else instead if its not working.
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
28 Jul 2016 10:24 PM
I figured it out, the value was the actual player itself.
Never using ObjectValues again.

u sicko!
Report Abuse
AlexanderLua is not online. AlexanderLua
Joined: 08 May 2015
Total Posts: 92
28 Jul 2016 10:27 PM
Oh wow, that's what I was trying to say the whole time. I need to be WAAAAAAAY more specific next time.
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