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

How do I fix a money script that gives you money thats not working when touched?

I made a pad that when you touch in it gives you money, but its not giving any money.

points2 = game.Workspace.Workshop.Table.Value.Value

script.Parent.Shop.Part.Touched:Connect(function(hit)
	if points2 >= 1 then
        player = game.Players:GetPlayerFromCharacter(hit.Parent)
		player.leaderstats.Money.Value = player.leaderstats.Money.Value + 25 * points2
		points2 = 0
	end
end)

1 answer

Try this

script.Parent.Shop.Part.Touched:Connect(function(hit)
        player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player then
        	player.leaderstats.Money.Value = player.leaderstats.Money.Value + 25
	end
end)

1 comment

0

It works, but it gives you money even if you don't have any parts to sell.

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