basset
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 14510 |
|
|
| 09 Jan 2013 06:02 PM |
I'm trying to make a giver that PERMANENTLY gives you the item, it lets you keep it after you die. However, this script only gives it to you when you die, and if you get two or more you can't delete them. Can I make this into a script that gives you the item when you first touch it and lets you permantntly keep it? Thanks.
local debounce = false
function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid") if (human ~= nil) and debounce == false then
debounce = true
local player = getPlayer(human)
if (player == nil) then return end
script.Parent.iceshard:clone().Parent = player.StarterGear
wait(2) debounce = false end end
script.Parent.Touched:connect(onTouch)
|
|
|
| Report Abuse |
|
|
basset
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 14510 |
|
| |
|
|
| 09 Jan 2013 06:13 PM |
> "Can I make this into a script that gives you the item when you first touch it and lets you permantntly [sic] keep it?"
Yes, go for it! |
|
|
| Report Abuse |
|
|
basset
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 14510 |
|
|
| 09 Jan 2013 06:16 PM |
| Where's CrazyMan32 when you need him? |
|
|
| Report Abuse |
|
|
|
| 09 Jan 2013 06:19 PM |
I've never seen "local players = game.Players:--children()--" before. Is it deprecated? |
|
|
| Report Abuse |
|
|
basset
|
  |
| Joined: 16 Jun 2008 |
| Total Posts: 14510 |
|
| |
|