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: A very simple little help

Previous Thread :: Next Thread 
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
28 Dec 2013 09:48 AM
I need this script to work that if you buy something (which works) and then die, you hold the item you bought.
Can anyone help me with this?
Here is the script:

print("Shop Script Loaded")

Door = script.Parent
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 onTouched(hit)
if debounce == false then
local human = hit.Parent:findFirstChild("Humanoid")
if (human == nil) then return end
local player = getPlayer(human)
debounce = true
if (player == nil) then return end
local stats = player:findFirstChild("leaderstats")
local sp = stats:findFirstChild("Points") --Change "Money" to the type of currency you have.
if sp == nil then return false end
if (sp.Value >=200) then --Amount of how much the weapon will go for,Change "100".
sp.Value = sp.Value - 200 --Put the same exact number here as you did above.
print("Enough Points")
game.Lighting.GravityCoil:clone().Parent = player.Backpack --Change PUTTOOLNAMEHERE to your weapons name.
Door.BrickColor = BrickColor.new(21) --MAKE SURE YOU PUT THE WEAPON/TOOL INTO LIGHTING.
wait(2)
Door.BrickColor = BrickColor.new(37) --Leave the rest of this alone.
debounce = false
else debounce = false
end
end

end

connection = Door.Touched:connect(onTouched)
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
28 Dec 2013 09:49 AM
Wait maybe this one works

http://www.roblox.com/Save-backpack-upon-death-script-item?id=36218553
Report Abuse
Smiley5991 is not online. Smiley5991
Joined: 15 Sep 2009
Total Posts: 259
28 Dec 2013 09:53 AM
See this line?
game.Lighting.GravityCoil:clone().Parent = player.Backpack

Below it, add:
game.Lighting.GravityCoil:clone().Parent = player.StarterGear
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
28 Dec 2013 10:01 AM
Yup works, thanks man :D
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