i'm trying to simulate a tycoon by making a dropper and money receiver.i'm trying to make it so when a child of a specific folder in Workspace touches the "MoneyReceive" then I gain Money in the leaderboard. here are my scripts
Main script
game.Players.PlayerAdded:Connect(function(player) -- all this code is just the leaderboard
local stats = Instance.new("IntValue", player)
stats.Name = "leaderstats"
local Points = Instance.new("IntValue", stats)
Points.Name = "Money"
-----------------------------------------------------------------------------------------------
local MoreCash = game.Workspace.CashStorage:GetChildren("GreenMoney", "RedMoney") -- I have a folder call CashStorage and I'm trying to make it so when the children of this folder touch "MoneyReceive" then my points/Money go up,think of it like a tycoon
game.Workspace.MoneyReceive.Touched:Connect(function(touched)
if touched == MoreCash then
Points = Points + 1
end
end)
end)
second script just in case - this script is the dropper script basically
incomeStorage = game.Workspace.PartStorage
script.Parent.ClickDetector.MouseClick:Connect(function(Mouse)
local RandomPart = math.random(1,2)
if RandomPart == 1 then
local Money1 = Instance.new("Part",incomeStorage)
Money1.Name = "RedMoney"
Money1.Position = game.Workspace["Item Dropper"].Position + Vector3.new(0,-0.5,0)
Money1.Color = Color3.fromRGB(255,0,0)
elseif RandomPart == 2 then
local Money2 = Instance.new("Part",incomeStorage)
Money2.Name = "GreenMoney"
Money2.Position = game.Workspace["Item Dropper"].Position + Vector3.new(0,-0.5,0)
Money2.Color = Color3.fromRGB(0,255,0)
end
end)

2 comments
it still didn't work when i test it the money in leaderboard doesn't increment at all when the CashStorage children touch MoneyReceiver
Oh that's my bad. I didn't catch the problem on line 3. If you want to create the leaderstats, make it a Folder, not IntValue. I'll just edit the Script right now.