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

Why dosen't this work It says (attempt to index nil with 'Value') why?

I need a script like this for my shop but it won't work please help me the script is

local price = script.Parent.Parent.Price
local tools = game.ReplicatedStorage:WaitForChild("Tools")
local tool = script.Parent.Parent.ItemName
local player = script.Parent.Parent.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Click:Connect(function()
	if player.leaderstats:FindFirstChild("Smelly Bucks").Value >= price.Value then
		player.leaderstats:FindFirstChild("Smelly Bucks").Value = player.leaderstats:FindFirstChild("Smelly Bucks").value - price.Value
		game.ReplicatedStorage.ShopBuy:FireServer(tool.Value)
	end
end)

Dose anyone know what is wrong with this?

2 comments

0

The line between 8 and 9 the value after "Smelly Bucks" is not with an capital V.

0

I think that should work!

1 answer

Your most likely defined it wrong, I dont have the exact line so I cant help you. If i were to guess you assnigned player wrong. Just do

Player = Game:GetService("Players").LocalPlayer

2 comments

0

I will test it

0

Still didnt work

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