|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
|
| 26 Sep 2017 04:15 AM |
I just told you how to fix it buddy
|
|
|
| Report Abuse |
|
|
|
| 26 Sep 2017 04:17 AM |
I am very sorry, I misread your answer. I will try to fix it now. Cheers |
|
|
| Report Abuse |
|
|
| |
|