attempt to index upvalue?
So simple shop GUI and this is the purchase button. Here is what it says when I try to click purchase:
Players.Player1.PlayerGui.Shop.infBack.Buy.LocalScript:8: attempt to index upvalue 'wep' (a nil value)
So yeah and here is the code:
1 | local but = script.Parent |
2 | local gun = but.Parent.Weapon.Value |
3 | local wep = game.ReplicatedStorage.Weps:FindFirstChild(gun) |
4 | local player = game.Players.LocalPlayer |
5 | local pack = player.Backpack |
7 | but.MouseButton 1 Click:connect( function () |
Weapon is a StringValue.
I tried changing the variable gun to just but.Parent.Weapon and no .Value but that also does not work.
Now i'm certain that the gun is in the folder(weps) in replicated storage I could see it when I clicked purchase so i'm not sure what i'm doing wrong here. Any help is appreciated :)