|
| 26 Sep 2017 03:22 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 |
|
|
| |
|
|
| 26 Sep 2017 05:54 AM |
put "Funds" inside of the event
script.Parent.MouseButton1Click:Connect(function() local funds = player.Stats.Money.Value --code end)
#code error("you're*") |
|
|
| Report Abuse |
|
|
| |
|