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

attempt to index nil with 'Value'?

Hello, Im trying to make a ShopGui, when click the server will be fire and the ClassicSword value will become true ( mean player will be own the sword ) but the issue is, is saying me the error 16:41:41.262 - ServerScriptService.onClickPurchase:3: attempt to index nil with 'Value' There is all of my script :

On Click Purchase Script ( SSS )

game.ReplicatedStorage.onClickBuy.OnServerEvent:Connect(function(plr)
	if plr.leaderstats.Gold.Value >= game.StarterGui.ShopGui.Frame.MainFrame.WeaponStats.Price.Value then
		if plr.WeaponStorage.OwnsWeapon:FindFirstChild(game.StarterGui.ShopGui.Frame.MainFrame.WeaponStats.WeaponValue.Value).Value == false then
			plr.WeaponStorage.OwnsWeapon:FindFirstChild(game.StarterGui.ShopGui.Frame.MainFrame.WeaponStats.WeaponValue.Value).Value = true
		else
				print("Purchase Failed!")
		end
	end
end)

Fire Server Script ( Buy Button )

script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.onClickBuy:FireServer()
end)

Can anyone help me?

1 answer

Noticed this:

if plr.leaderstats.Gold.Value >= game.StarterGui.ShopGui.Frame.MainFrame.WeaponStats.Price.Value 

3 comments

0

Maybe its that?

0

It happend on line 3 so it cant be that

0

Yes sorry I made a mistake

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