Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I did this Speed Upgrade Thing But I want It to take Money away How do I do it?

Asked by 6 years ago

i want it to take money away when I get a speed Boost But It wont Work and I don't Get any errors Either

button = script.Parent
player = game.Players.LocalPlayer
char = player.Character
humanoid = char.Humanoid
price = 50
speed = 17
max = false

button.MouseButton1Click:connect(function()
if humanoid.WalkSpeed == 140 then   


if player.leaderstats.Money <= price then
        print("Not Enough")

elseif max == false then
humanoid.WalkSpeed = speed
speed = speed + 1
price = price + 25
player.leaderstats.Money = player.leaderstats.Money - price
wait(2)
end
end
end)
0
do you have filtering on? lukeb50 631 — 6y
0
no FilthyMonsterPlays 8 — 6y
0
Y does that Make Any difference? FilthyMonsterPlays 8 — 6y
0
Because if it was on that would be a bigger problem. Il answer below lukeb50 631 — 6y
0
Ok Thx FilthyMonsterPlays 8 — 6y

1 answer

Log in to vote
0
Answered by
lukeb50 631 Moderation Voter
6 years ago

When you are trying to remove the money and check it, you are forgetting to add .Value. This is required to get the value of a Value Object.

button = script.Parent
player = game.Players.LocalPlayer
char = player.Character
humanoid = char.Humanoid
price = 50
speed = 17
max = false

button.MouseButton1Click:connect(function()
if humanoid.WalkSpeed == 140 then   


if player.leaderstats.Money.Value <= price then
        print("Not Enough")

elseif max == false then
humanoid.WalkSpeed = speed
speed = speed + 1
price = price + 25
player.leaderstats.Money.Value = player.leaderstats.Money.Value - price
wait(2)
end
end
end)
0
Ok let me try that and Thx FilthyMonsterPlays 8 — 6y
0
Sorry but It wont Work FilthyMonsterPlays 8 — 6y
0
try adding player.CharacterAdded:wait() on line 4 lukeb50 631 — 6y
0
ok FilthyMonsterPlays 8 — 6y
0
that was Not the Answer But U leaded Me To The solution, it was that i forgot an else for Line 10 But thx Ill take your help FilthyMonsterPlays 8 — 6y
Ad

Answer this question