|
| 14 Aug 2013 10:13 PM |
When the player touches a button, they are supposed to get a weapon for 0 kills. But it does not work. Here is 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("value") --This is the money name. If it costs KO's, then keep this the same. If not, put the exact currency name in (ex. Money, Currency, Cash, etc.) if sp == nil then return false end if (sp.Value >=0) then --Change 5 to the amnt of KOs it costs sp.Value = sp.Value - 0 --Put the exact same number as you just put above. print("Enough Money") game.Debris. M2-84 Assault Rifle :clone().Parent = player.Backpack --Change WeaponName to your tool/weapon's name game.Debris.M2-84 Assault Rifle:clone().Parent=player.StarterGear --Change WeaponName to your tool/weapon's name Door.BrickColor = BrickColor.new(37) --Drag the tool/weapon into debris wait(2) Door.BrickColor = BrickColor.new(21) --Leave the rest of this alone debounce = false else debounce = false end end |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2013 10:18 PM |
local sp = stats:findFirstChild("value")
You really have KO's named 'value'?
Change it to the name of the intValue you have in the Leaderstats |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2013 10:21 PM |
| ok I will try but I did try that value was the latest thing I tried. |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2013 10:23 PM |
Ok for me to fix it, what is the name of all your things in the leaderstats in the player.
(also tell me which you want it to look off of) |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2013 10:23 PM |
| I tried everything this is leaderstats script maybe u could figure out what the in.value is. |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2013 10:24 PM |
print("LinkedLeaderboard script version 5.00 loaded")
stands = {} CTF_mode = false
function onHumanoidDied(humanoid, player) local stats = player:findFirstChild("leaderstats") if stats ~= nil then local deaths = stats:findFirstChild("Wipeouts") deaths.Value = deaths.Value + 1
-- do short dance to try and find the killer
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
handleKillCount(humanoid, player) end end
function onPlayerRespawn(property, player) -- need to connect to new humanoid if property == "Character" and player.Character ~= nil then local humanoid = player.Character.Humanoid local p = player local h = humanoid humanoid.Died:connect(function() onHumanoidDied(h, p) end ) end end
function getKillerOfHumanoidIfStillInGame(humanoid) -- returns the player object that killed this humanoid -- returns nil if the killer is no longer in the game
-- check for kill tag on humanoid - may be more than one - todo: deal with this local tag = humanoid:findFirstChild("creator")
-- find player with name on tag if tag ~= nil then local killer = tag.Value if killer.Parent ~= nil then -- killer still in game return killer end end
return nil end
function handleKillCount(humanoid, player) local killer = getKillerOfHumanoidIfStillInGame(humanoid) if killer ~= nil then local stats = killer:findFirstChild("leaderstats") if stats ~= nil then local kills = stats:findFirstChild("KOs") if killer ~= player then kills.Value = kills.Value + 1 else kills.Value = kills.Value - 1 end end end end |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2013 10:24 PM |
| Not the script the actual model named leaderstats within the player. What are the children within it? |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2013 10:33 PM |
| there is nothing under players the leaderboard is a script |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2013 10:36 PM |
local sp = stats:findFirstChild("KOs") --This is the money name. If it costs KO's, then keep this the same. If not, put the exact currency name in (ex. Money, Currency, Cash, etc.) if sp == nil then return false end
(ง'̀-'́)ง If that wasn't it.............argg`1!
|
|
|
| Report Abuse |
|
|
|
| 14 Aug 2013 10:41 PM |
| it is KOs so that part is right |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2013 10:43 PM |
Model:findFirstChild("NAMEOFOBJECTHERE"[,true/false check through the children for this])
You can't put value or else it will look for value.
You put KOs and it will search for KOs which it should find. (ง'̀-'́)ง I got nothing |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Aug 2013 10:51 PM |
| I put KOs it does not work |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2013 10:57 PM |
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("KOs") -- THIS IS THE NAME OF THE OBJECT --I AM GOING TO GO INSANE 0.1 if sp == nil then return false end if (sp.Value >=0) then --Change 5 to the amnt of KOs it costs sp.Value = sp.Value - 0 --Put the exact same number as you just put above. print("Enough Money") game.Debris. M2-84 Assault Rifle :clone().Parent = player.Backpack --Change WeaponName to your tool/weapon's name game.Debris.M2-84 Assault Rifle:clone().Parent=player.StarterGear --Change WeaponName to your tool/weapon's name Door.BrickColor = BrickColor.new(37) --Drag the tool/weapon into debris wait(2) Door.BrickColor = BrickColor.new(21) --Leave the rest of this alone debounce = false else debounce = false end end |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2013 11:51 PM |
| It does not work. Do you know any shop scripts that will work because I use LinkedLeadeboard not Leaderstats. |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 14 Aug 2013 11:53 PM |
narwhale! So we meet again?
I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! I HATE YOU! |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 14 Aug 2013 11:57 PM |
Also To help you.. The Value name has to be the same as one in the leaderbored. And it doesent work in solo mode you have to play it yourself. |
|
|
| Report Abuse |
|
|