Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
|
| 21 Feb 2016 07:54 PM |
This script is inside of a button and when you click the button you are supposed to get the TotalXP value and Gold value and Crafting XP value, only if you have the required leaderstats which are Purple Silk, Orange Silk, Blue Silk, and Green Silk. And it's not working for some reason. Help please!
local player = game.Players.LocalPlayer local gold = player.leaderstats:WaitForChild("Crafting XP") local kills = player.leaderstats:WaitForChild("Purple Silk") local kills2 = player.leaderstats:WaitForChild("Orange Silk") local kills3 = player.leaderstats:WaitForChild("Blue Silk") local kills4 = player.leaderstats:WaitForChild("Green Silk") local money = player.leaderstats:WaitForChild("Gold") -- First get the Gold stat, wait for it so no errors local totalXP = player.leaderstats:WaitForChild("Total XP") -- Same thing
local button = script.Parent local killsNeeded = 1 -- NUMBER OF KILLS NEEDED TO DO SOMETHING GOES HERE local kills2Needed = 1 -- NUMBER OF KILLS NEEDED TO DO SOMETHING GOES HERE local kills3Needed = 1 -- NUMBER OF KILLS NEEDED TO DO SOMETHING GOES HERE local kills4Needed = 1 -- NUMBER OF KILLS NEEDED TO DO SOMETHING GOES HERE local giveGold = 5 -- HOW MUCH GOLD (SEEDS) IT GIVES HERE local xpGiven = 5 -- TOTAL XP GIVEN local goldGiven = 1 -- TOTAL GOLD GIVEN
function buttonClicked() if kills.Value and kills2.Value and kills3.Value and kills4.Value >= killsNeeded and kills2Needed and kills3Needed and kills4Needed then -- do they have enough kills? kills.Value = kills.Value - killsNeeded -- take away those kills kills2.Value = kills2.Value - killsNeeded -- take away those kills kills3.Value = kills3.Value - killsNeeded -- take away those kills kills4.Value = kills4.Value - killsNeeded -- take away those kills gold.Value = gold.Value + giveGold -- and instead give them moneyyyyy money.Value = money.Value + goldGiven -- give totalXP.Value = totalXP.Value + xpGiven -- give end end
button.MouseButton1Click:connect(buttonClicked) |
|
|
| Report Abuse |
|
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
| |
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
| |
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
| |
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
| |
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
| |
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
| |
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
| |
|