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
 

[ Content Deleted ]

Previous Thread :: Next Thread 
DeHata is not online. DeHata
Joined: 02 Oct 2011
Total Posts: 617
13 Oct 2011 11:56 PM
function OnTouched(Hit)
local if Hit.Parent.Inventory == nil and Hit.Parent.AltHealth == nil then
x = Instance.new("Model", Hit)
x.Name = "Inventory"
y = Instance.new("NumberValue", Hit)
y.Name = "AltHealth"
y.Value = 100
end
end

script.Parent.Touched:connect(OnTouched)

I used this instead of a player added because player added doesn't account for if a player respawns.. Also, If the game is still loading, I found it to not count said player because the script has not loaded yet. This is so that my RPG can interact with inventories and whatnot by inserting models into the player that the items can interact with.. The output says that the inventory and althealth are nil, but that is what I am trying to detect, that way my script knows to add the items.. the thing is, if a problem is detected within a script - the whole script breaks.
Report Abuse
Lowcart is not online. Lowcart
Joined: 12 Sep 2011
Total Posts: 1323
14 Oct 2011 12:05 AM
[ Content Deleted ]
Report Abuse
DeHata is not online. DeHata
Joined: 02 Oct 2011
Total Posts: 617
14 Oct 2011 12:09 AM
Read the thing below the script........
Report Abuse
Lowcart is not online. Lowcart
Joined: 12 Sep 2011
Total Posts: 1323
14 Oct 2011 12:11 AM
[ Content Deleted ]
Report Abuse
DeHata is not online. DeHata
Joined: 02 Oct 2011
Total Posts: 617
14 Oct 2011 12:12 AM
Oohh.. See, If you can't tell, I'm kinda new to this scripting stuff......
Report Abuse
Lowcart is not online. Lowcart
Joined: 12 Sep 2011
Total Posts: 1323
14 Oct 2011 12:14 AM
[ Content Deleted ]
Report Abuse
DeHata is not online. DeHata
Joined: 02 Oct 2011
Total Posts: 617
14 Oct 2011 12:18 AM
function Character(New)
x = Instance.new("Model", New)
x.Name = "Inventory"
y = Instance.new("NumberValue", New)
y.Name = "AltHealth"
y.Value = 100
end

game.Workspace.CharacterAdded:connect(Character)

--

I tried using Players as a parent (in the connection line) as well, and it still didn't work... Now what?
Report Abuse
DeHata is not online. DeHata
Joined: 02 Oct 2011
Total Posts: 617
14 Oct 2011 12:19 AM
Player added is what i did before! It didn't work because the player was already in...... And the script was already loaded....
Report Abuse
Lowcart is not online. Lowcart
Joined: 12 Sep 2011
Total Posts: 1323
14 Oct 2011 12:21 AM
[ Content Deleted ]
Report Abuse
DeHata is not online. DeHata
Joined: 02 Oct 2011
Total Posts: 617
14 Oct 2011 12:21 AM
I'll try...
Report Abuse
DeHata is not online. DeHata
Joined: 02 Oct 2011
Total Posts: 617
14 Oct 2011 12:23 AM
which would I assign the models to, in the game, they are supposed to be assigned to the player in the workspace.
Report Abuse
Lowcart is not online. Lowcart
Joined: 12 Sep 2011
Total Posts: 1323
14 Oct 2011 12:24 AM
[ Content Deleted ]
Report Abuse
DeHata is not online. DeHata
Joined: 02 Oct 2011
Total Posts: 617
14 Oct 2011 12:24 AM
I finally got it to work, I fiddled around with your latest script. Thank you much!
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
14 Oct 2011 05:57 AM
hmm. I never used character added before. for my alt health script I just made a script with game.Workspace.ChildAdded then checked to see if the child had a "Humanoid" in it.
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