Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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 comment

1 answer

✓ Accepted answer

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

1 comment

0

OMG THANK YOU SO MUCH

This discussion is preserved as it was. New answers, comments, and votes are closed.