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

Why Isn't my leaderstats script cooperating?

Asked by 5 years ago

I am making a tycoon, and I have a script to make a wall appear when the player has a certain amount of money, but There keeps being a red line under the minus symbol. Heres the script:

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if player.leaderstats.Cash.Value >= 1000 then
            game.Workspace.wall.CanCollide = true
            game.Workspace.wall.Transparency = 0
            player.leaderstats.Cash.Value - 1000   -- Here is the error. The minus is squiggled.
        end
    end
end)

1 answer

Log in to vote
1
Answered by
T1mes 230 Moderation Voter
5 years ago

You need to change it to

player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 1000

You need to subtract it this way otherwise it would not work.

0
Oh yeah im stupid SBlankthorn 329 — 5y
0
np, we all make mistakes. T1mes 230 — 5y
Ad

Answer this question