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

Cant take away the cash and cant get the second item?

Asked by 5 years ago

When I fire the Event with this

game.ReplicatedStorage.BuyTool:FireServer(212641536)

it works, but it dosent take away the Players cash. It gives me this error... and if i fire it but like this.

game.ReplicatedStorage.BuyTool:FireServer(78730532)

it dosent do anything. Nothing comes in the Output.

local Remote = game:GetService('ReplicatedStorage'):WaitForChild('BuyTool')
local LoadAsset = game:GetService('InsertService')

Remote.OnServerEvent:Connect(function(plr, ID)
    if ID == 212641536 then
        if plr.leaderstats.Cash.Value >35 then
            LoadAsset:LoadAsset(212641536):GetChildren()[1].Parent = plr.Backpack
            plr.leaderstats.Cash.Value = plr.leaderstats.Cash -35
        elseif
            ID == 78730532 then
            if plr.leaderstats.Cash.Value >50 then
                LoadAsset:LoadAsset(78730532):GetChildren()[1].Parent = plr.Backpack
                plr.leaderstats.Cash.Value = plr.leaderstats.Cash -50
            end
        end
    end
end)

1 answer

Log in to vote
1
Answered by
Despayr 505 Moderation Voter
5 years ago

line 8

plr.leaderstats.Cash.Value = plr.leaderstats.Cash -35

you forgot to put .Value

it should be

plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value -35

you made the same error on line 13

0
OMG THANK YOU SO MUCH Enomphia 39 — 5y
Ad

Answer this question