Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

attempt to index nil with 'Value'?

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

Noticed this:

if plr.leaderstats.Gold.Value >= game.StarterGui.ShopGui.Frame.MainFrame.WeaponStats.Price.Value 
0
Maybe its that? SharkTailOof 22 — 4y
0
It happend on line 3 so it cant be that OriginalDevelops 22 — 4y
0
Yes sorry I made a mistake SharkTailOof 22 — 4y
Ad

Answer this question