Hello, I'm following a tutorial (https://www.youtube.com/watch?v=c8bWOSU7WKw) and I'm struggling in scripting the Buy button thing.
Players.SharkDoodlebanger.PlayerGui.Shop.Frame.Info.Frame.Buy.LocalScript:9: attempt to index upvalue 'tool' (a nil value) 21:07:25.191 - Stack Begin 21:07:25.192 - Script 'Players.SharkDoodlebanger.PlayerGui.Shop.Frame.Info.Frame.Buy.LocalScript', Line 9 21:07:25.192 - Stack End
here is my code:
local price = script.Parent.Parent.Parent.Price local tools = game.ReplicatedStorage:WaitForChild("Tools") local tool = tools:FindFirstChild(script.Parent.Parent.Parent.ItemName.Value) local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function() if player.leaderstats:FindFirstChild("Token").Value >= price.Value then player.leaderstats:FindFirstChild("Token").Value = player.leaderstats:FindFirstChild("Token").Value - price.Value local clone2 = tool:Clone() clone2.Parent = player.StarterGear end end)

3 comments
Smh
guess what it means script.Parent.Parent.Parent.ItemName.Value is not a child of tools and returning nil
lool