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
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 1323 |
|
| |
|
DeHata
|
  |
| Joined: 02 Oct 2011 |
| Total Posts: 617 |
|
|
| 14 Oct 2011 12:09 AM |
| Read the thing below the script........ |
|
|
| Report Abuse |
|
|
Lowcart
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 1323 |
|
| |
|
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
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 1323 |
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 1323 |
|
| |
|
DeHata
|
  |
| Joined: 02 Oct 2011 |
| Total Posts: 617 |
|
| |
|
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
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 1323 |
|
| |
|
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 |
|
|
|
| 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 |
|
|