Shop using DataStore Index Problem

  1. What do you want to achieve? A shop that gets the bool value from a boolvalue inside the player object

  2. What is the issue? I’m getting the error Players.aresrii.PlayerGui.BestShop.ScrollingFrame.BuyObamaFigure.Purchase:6: attempt to index number with 'ownsGear'

  3. What solutions have you tried so far? I searched for my problem on the DevForum and google and nothing is helping.

Note: The BoolValue is in the player successfully

local amountToRemove = 100

local remote = game:GetService("ReplicatedStorage").Remotes.RemoveCurrency

script.Parent.MouseButton1Down:Connect(function(plr)
	if plr.ownsGear.OwnsObamaFigure.Value == false then
		remote.FireServer(amountToRemove)
		plr.ownsGear.OwnsObamaFigure.Value = true
	else
		script.Parent.Text = "you already have this dummy"
		script.Parent.TextColor3 = Color3.new(1, 0, 0)
		wait(1)
		script.Parent.Text = "obama figure                                                                  100 points"
		script.Parent.TextColor3 = Color3.new(0.854902, 0.854902, 0.854902)
	end
end)
1 Like

Is this the entire script? Cause I don’t see a datastore …

The DataStore part is in another script and I am using a RemoteEvent to remove money

theres a typo in your code
image

it should be : instead of a dot

Also, its really insecure to fire the amount to remove (if its a number) since an exploiter can just modify the Fire and change it to a large negative amount which will result in getting more money on the server end

1 Like

Are they any other secure methods to remove money you would recommend?