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: Can you help me fix this little problem?

Previous Thread :: Next Thread 
basset is not online. 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 is not online. basset
Joined: 16 Jun 2008
Total Posts: 14510
09 Jan 2013 06:11 PM
iBump
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
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 is not online. basset
Joined: 16 Jun 2008
Total Posts: 14510
09 Jan 2013 06:16 PM
Where's CrazyMan32 when you need him?
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
09 Jan 2013 06:19 PM
I've never seen "local players = game.Players:--children()--" before.
Is it deprecated?
Report Abuse
basset is not online. basset
Joined: 16 Jun 2008
Total Posts: 14510
09 Jan 2013 06:26 PM
Yes.
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