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: Add shop items to backpack permanently?

Previous Thread :: Next Thread 
imbetterthanU123456 is not online. imbetterthanU123456
Joined: 30 May 2010
Total Posts: 1701
25 Jun 2012 01:53 PM
Ok so I got a shop script going and they get the money and buy item, you know how it works, but when they die they don't re-spawn with it and have to buy it again. Does anyone know how to make it so they re-spawn with that item. Heres the script if it helps (yeah I suck at scripting)
print("Shop Script Loaded")

Door = script.Parent
local debounce = false

function getPlayer(humanoid)
local players = game.Players:children() -- Don't change
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") --Don't change
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("Cash") -- Change "Seconds Alive" to what your leaderboard has like (Your leaderboard says "Money" Change "Seconds Alive" To "Money")
if sp == nil then return false end
if (sp.Value >=50) then -- 30 means you have to have that amount or you won't get it you can change if you want :)
sp.Value = sp.Value - 50 -- delete this line if u want it to not -50 points
print("Enough Money")
game.Lighting.Sabre:clone().Parent = player.Backpack --type the name of the item and put it in lighting
Door.BrickColor = BrickColor.new(1004)
wait(2) -- Before being able to buy again
Door.BrickColor = BrickColor.new(1001)
debounce = false
else debounce = false
end
end
end

connection = Door.Touched:connect(onTouched)
Report Abuse
lombardo2 is not online. lombardo2
Joined: 30 Nov 2008
Total Posts: 1604
25 Jun 2012 01:57 PM
To lazy to read the script, just add the tool to starter gear
Report Abuse
imbetterthanU123456 is not online. imbetterthanU123456
Joined: 30 May 2010
Total Posts: 1701
25 Jun 2012 02:15 PM
But the everyone would spawn with it, I only want it as a shop item.
Report Abuse
SuperSoldier44 is not online. SuperSoldier44
Joined: 13 Jun 2012
Total Posts: 37
25 Jun 2012 02:21 PM
If I'm correct, StarterGear is for a individual player. Your most likely think of StartPack
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
25 Jun 2012 02:21 PM
Door = script.Parent
local debounce = false
function getPlayer(humanoid)
local players = game.Players:children() -- Don't change
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") --Don't change
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("Cash") -- Change "Seconds Alive" to what your leaderboard has like (Your leaderboard says "Money" Change "Seconds Alive" To "Money")
if sp == nil then return false end
if (sp.Value ​>=50) then -- 30 means you have to have that amount or you won't get it you can change if you want :)
sp.Value = sp.Value - 50 -- delete this line if u want it to not -50 points
print("Enough Money")
game.Lighting.Sabre:clone().Parent = player.Backpack --type the name of the item and put it in lighting
game.Lighting.Sabre:clone().Parent = player.StarterGear
Door.BrickColor = BrickColor.new(1004)
wait(2) -- Before being able to buy again
Door.BrickColor = BrickColor.new(1001)
debounce = false
else debounce = false
end
end
end
connection = Door.Touched:connect(onTouched)
Report Abuse
imbetterthanU123456 is not online. imbetterthanU123456
Joined: 30 May 2010
Total Posts: 1701
25 Jun 2012 02:46 PM
Thank you! You have no idea how long I've been trying to fix this.
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