|
| 26 Mar 2013 07:52 PM |
Could someone make it that when you respawn, your weapons will still be there. If you buy the weapon and die its not there in your backpack:
------------------------------------------------------------------------------------- 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("Kills") --Change "Money" to the type of currency you have. if sp == nil then return false end if (sp.Value >=10) then --Amount of how much the weapon will go for,Change "100". sp.Value = sp.Value - 10 --Put the same exact number here as you did above. print("Enough Money") game.Lighting.UZI: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 |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
| |
|
keehl254
|
  |
| Joined: 08 Sep 2010 |
| Total Posts: 131 |
|
|
| 26 Mar 2013 08:22 PM |
T>T simple mistake... You cloned it into the backpack, just not into the starter gear for that player...I took the time to add it because im one who likes to be shown what to do, not told... I thought you could be the same way lol
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("Kills") if sp == nil then return false end if (sp.Value >=10) then"100". sp.Value = sp.Value - 10 print("Enough Money") game.Lighting.UZI:clone().Parent = player.Backpack game.Lighting.UZI:clone().Parent = player.StarterGear ---PUT IT INT THE STARTERGEAR TOO :D Door.BrickColor = BrickColor.new(21) wait(2) Door.BrickColor = BrickColor.new(37) debounce = false else debounce = false end end
end
connection = Door.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
| |
|