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

cash is not a valid member of Folder why is it say?

I want to make a shop script and it say cash is not a valid member of Folder i put the codes

game.Players.PlayerAdded:Connect(function(player) local leaderstats= Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player

local cash= Instance.new("NumberValue")
cash.Name="Money"
cash.Value = 1000000
cash.Parent=leaderstats

end)

its called serverstats and the another

game.ReplicatedStorage.Toolevents.Akevent.OnServerEvent:Connect(function(player) if player.leaderstats.cash.Value >= 5000 then player.leaderstats.cash.Value = player.leaderstats.cash.Vaule - 5000 game.ServerStorage.Tools.Ak.Clone().Parent = player.Backpack end end)

and its called Buytools

idk what the problem pls help

2 comments

0

I can send you the script I have for my leaderboard but I dont know one for buying tools (The leaderboard autosaves too)

0

Please put your code in code blocks

3 answers

✓ Accepted answer

You made the name of the cash instance "Money", change that to "cash"

1 comment

0

That can be written as anything as long as he continues saying that its Money=Cash

Well 1st of all you don't really need a remote event for your buying script.

Try using this script:

game.Players.PlayerAdded:Connect(function(player)

local leaderstats = Instance.New("Folder")
leaderstats.Name = leaderstats
leaderstats.Parent = game.Players.player

local cash = Instance.new("IntValue")
cash.Name = "Money"
cash.Value = 1000000
cash.Parent =  leaderstats

Didnt test so if it doesnt work lmk

So this leaderboard can have two values at a time and it auto saves:

-- it AUTO SAVE!!!!!!!!!!
local datastore = game:GetService("DataStoreService")
local data1 = datastore:GetDataStore("mystrengthdata")
local data2 = datastore:GetDataStore("myrebirthsdata")

game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats" -- DONT CHANGE THIS!
local rebirths = Instance.new("IntValue", leaderstats)
rebirths.Name = "Cash" --CHANGE IT TO YOUR OWN NAME!
local strength = Instance.new("IntValue", leaderstats)
strength.Name = "Rounds" --CHANGE THIS TO YOUR OWN NAME!
strength.Value = data1:GetAsync(player.UserId) or 0
data1:SetAsync(player.UserId, strength.Value)
rebirths.Value = data2:GetAsync(player.UserId) or 0
data2:SetAsync(player.UserId, rebirths.Value)

game.Players.PlayerRemoving:connect(function()
data1:SetAsync(player.UserId, strength.Value)
data2:SetAsync(player.UserId, rebirths.Value)
end)
end)
-- dont need to credit me, i dont need credit. Ok?

Accept this answer if it works. Also put this in a script and put the script into ServerScriptService :)

1 comment

0

Dont worry about the strength and the rebirth bits

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