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:
local but = script.Parent local gun = but.Parent.Weapon.Value local wep = game.ReplicatedStorage.Weps:FindFirstChild(gun) local player = game.Players.LocalPlayer local pack = player.Backpack but.MouseButton1Click:connect(function() wep:Clone(pack) end)
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 :)
There are two possibilities here, either line 3 with isn't getting a string as the first argument, or the object doesn't exist under than name