I am trying to make a shop gui and one of the items is Grappling Hook. I have this script there are no errors but yet when I test it in studio it does not give me the grappling hook. I do have enough coins too when I test it. Here is the script.
local coins = script.Parent.Coins
for i, v in pairs(script.Parent.Frame:GetChildren()) do -- i got this idea from berezaa and yes it does work
if v:IsA("TextButton" or "ImageButton") then
v.MouseButton1Click:connect(function()
if v.Name == "GrapplingHook" then -- these are the parts I'm concerned about
if coins.Value > 349 then
coins.Value = coins.Value - 350
local clone = game.Lighting.GrapplingGun:Clone()
clone.Parent = game.Players.LocalPlayer.Backpack
end
end
end)
end
end

3 comments
On line 6 you called in GraplingHook, but on line 9 GrapplingGun, this may be the problem
Is this in a LocalScript?
This is a local script