|
| 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
|
  |
| 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 |
|
|
|
| 25 Jun 2012 02:15 PM |
| But the everyone would spawn with it, I only want it as a shop item. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 25 Jun 2012 02:46 PM |
| Thank you! You have no idea how long I've been trying to fix this. |
|
|
| Report Abuse |
|
|