Angel8365
|
  |
| Joined: 26 Apr 2010 |
| Total Posts: 101 |
|
|
| 03 Apr 2012 06:46 AM |
| I need help, when i make a shop it works but when you die you lose the item you purchased. How do i fix that? |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
Angel8365
|
  |
| Joined: 26 Apr 2010 |
| Total Posts: 101 |
|
|
| 03 Apr 2012 06:58 AM |
This is the shop script tell me if anything is wrong that won't make it save.
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("Gold") if sp == nil then return false end if (sp.Value >= 10) then sp.Value = sp.Value - 10 print("Enough Money") game.Lighting.BronzeSword:clone().Parent = player.Backpack 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 |
|
|
UFAIL2
|
  |
| Joined: 14 Aug 2010 |
| Total Posts: 6905 |
|
|
| 03 Apr 2012 08:09 AM |
| I'm not even going to look at the script; just add all the weapons they buy into the script, and when they die, re-add them to their backpack. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2012 08:15 AM |
| Or when it clones the tool, make sure to put it in their Starttools or whatever folder |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2012 08:25 AM |
| It is called SarterGear, I think. If you put it in StarterPack, everybody gets it. |
|
|
| Report Abuse |
|
|
Angel8365
|
  |
| Joined: 26 Apr 2010 |
| Total Posts: 101 |
|
|
| 03 Apr 2012 03:32 PM |
| How do i re add weapons to their backpack? |
|
|
| Report Abuse |
|
|
juriaan
|
  |
| Joined: 25 Nov 2008 |
| Total Posts: 939 |
|
|
| 03 Apr 2012 04:09 PM |
Alright here a Little way of doing it
Tools = {"Sword"}
Game.Players.PlayerAdded:connect(function(new) local val = Instance.new("IntValue") val.Name = "Weaponkeep" val.Parent = new local ba = Instance.new("BoolValue") ba.Name = "SwordGot" ba.Parent = val end)
Game.Workspace.ChildAdded:connect(function(newc) if game.Players:findFirstChild(newc.Name) then if game.Players[newc.Name].Weaponkeep.SwordGot.Value == true then Game.Lighting[Tools[i]]:clone().Parent = Game.Players[newc.Name].Backpack else print("Error !") end else print("Not a Player") end end)
Glad to help, Juriaan and Velibor
~ Server Lab is coming soon ! ~
|
|
|
| Report Abuse |
|
|
Defendur
|
  |
| Joined: 31 Mar 2012 |
| Total Posts: 40 |
|
|
| 03 Apr 2012 04:28 PM |
Okay. Player has two types of gear.
StarterGear (that one player gets it when he spawns, just like Gear, only if it was allowed)
BackPack (a temporary toolkit.)
StarterPack automatically inserts a tool into everyones BackPack when the player spawns. |
|
|
| Report Abuse |
|
|