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
 

Shop Button Help

Previous Thread :: Next Thread 
Stephanie_Angela is not online. Stephanie_Angela
Joined: 28 Oct 2016
Total Posts: 55
26 Sep 2017 04:07 AM
Hello everyone, I am new to scripting. I created a local script where if a button is pressed, it would take 2400 from me and give me a sword. The problem is, when I tested it, it would only print "insufficient funds" and not give me the sword even if it's over 2400.

Script:

local amount = 2400
local player = game.Players.LocalPlayer
local Funds = game.Players.LocalPlayer.Stats.Money.Value


script.Parent.MouseButton1Click:connect(function()
print("Button1 Clicked")


if Funds >= amount and not player.Backpack:FindFirstChild("ClassicSword") and not player.Character:FindFirstChild("ClassicSword") then
game.ReplicatedStorage["ClassicSword"]:Clone().Parent = game.Players.LocalPlayer.Backpack
print("Sword bought")
else
print("Insufficient Funds")


end
end)

Thank you for your help.
Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
26 Sep 2017 04:10 AM
You need to declare funds as a variable inside of the function.




Report Abuse
Stephanie_Angela is not online. Stephanie_Angela
Joined: 28 Oct 2016
Total Posts: 55
26 Sep 2017 04:14 AM
I created a modulescript within serverscript which declares the functions of funds, but I am simply not able to make this work.

If you want, I can post the modulescipt, but I am sure that isn't the problem.
Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
26 Sep 2017 04:15 AM
I just told you how to fix it buddy


Report Abuse
Stephanie_Angela is not online. Stephanie_Angela
Joined: 28 Oct 2016
Total Posts: 55
26 Sep 2017 04:17 AM
I am very sorry, I misread your answer.
I will try to fix it now. Cheers
Report Abuse
Stephanie_Angela is not online. Stephanie_Angela
Joined: 28 Oct 2016
Total Posts: 55
26 Sep 2017 04:36 AM
:(
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