generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Script Isn't Working

Previous Thread :: Next Thread 
Mezur is not online. 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 is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
21 Feb 2016 07:56 PM
b1
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
21 Feb 2016 07:58 PM
b2
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
21 Feb 2016 07:58 PM
b3
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
21 Feb 2016 07:59 PM
b4
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
21 Feb 2016 08:02 PM
b5
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
21 Feb 2016 08:03 PM
b6
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
21 Feb 2016 08:08 PM
b7
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image