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

My shop GUI won't work?

I'm making a shooter, and I'm making a shop. The problem is, whenever I click on the shop item I'm trying to get, I don't get anything. Here's the script for the button:

repeat wait()
	Player = game.Players.LocalPlayer
Button = script.Parent
Item = game.ReplicatedStorage:FindFIrstChild("GravityCoil")
Cost = 50
Money = Player.leaderstats.Money	
until

Button.MouseButton1Down:connect(function(purchase)
	if Money.Value > (Cost - 1) then
		Money.Value = Money.Value - Cost 
		local a = Item:Clone()
		a.Parent = Player.Backpack
		local b = Item:Clone()
		b.Parent = Player.StarterGear
	end
end)

This is the script for the leaderboard I was using (I gave myself 50 money)

game.Players.PlayerAdded:connect(function(p)
	local stats = Instance.new("IntValue", p)
	stats.Name = ("leaderstats")
	
	local money = Instance.new("IntValue", stats)
	money.Name = "Money"
	money.Value = 50
end)

Thanks in advance!

1 answer

✓ Accepted answer

The problem is that you're trying to look for FindFIrstChild, which will give an error. Remember lua is case sensitive! By fixing that small spelling error, the script should work right for you.

Item = game.ReplicatedStorage:FindFirstChild("GravityCoil")

3 comments

0

Yep. thx

0

Thumbs up and accept the answer if this helped!

0

I accepted :c Right after I typed the question I looked back into the script and found my error :P. Thanks for answering tho :)

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