Hopefully i get this right this time :'), so i had a look and all the post that a similar to mine have been removed for duplication or arent on here anymore and nothing helps on Wikipedia.
((Buying Script for my Sword Shop Gui )))) (i use gold , dont know if it matters)
This is my explanation. I have spent a ridiculous amount of time trying to fix this shop up and i could really use some help as it would help me progress in my game, I've tried scripting it in so many ways i tried using other peoples scripts. It is set up to a text button and when you click on it, it opens up the shop but when you purchase one of the items it takes the gold needed but the item doesn't go into my inventory.
I got a ranged shop, staff shop, spell shop,sword shop, armor shop and its all connected as you can see from the script bellow but yet after checking over it a billion times going through all the scripts i cant seem to find a single error so i need help from experienced scripters in helping me to find the solution for my new rpg roblox game that i'm making . since everything is connected once i work out how to get my sword shop to work everything else will work. is been a major setback on the game hopefully this is enough information i will be gladly to give you my output or anything else you need, just need some help..
BUY SCRIPT OF SHOP GUI
local items = script.Parent.Frame:GetChildren()
for i = 1, #items do
function buy()
Cash = script.Parent.Parent.Parent.Parent.leaderstats:FindFirstChild(items[i].Currency.Value)
h = Instance.new("Hint")
h.Parent = script.Parent.Parent.Parent
if Cash.Value >= items[i].Cost.Value then
Cash.Value = Cash.Value - items[i].Cost.Value
toolca = Game.ReplicatedStorage:FindFirstChild(script.Parent.Folder.Value):FindFirstChild(items[i].ItemName.Value):Clone()
toolcb = Game.ReplicatedStorage:FindFirstChild(script.Parent.Folder.Value):FindFirstChild(items[i].ItemName.Value):Clone()
toolca.Parent = script.Parent.Parent.Parent.Parent.Backpack
toolcb.Parent = script.Parent.Parent.Parent.Parent.StarterGear
print("Successfully bought!")
h.Text = "You have bought " ..items[i].ItemName.Value.. "!"
else print("Insufficient money!")
h.Text = "You don't have enough " ..items[i].Currency.Value.. "!"
end
Game:GetService("Debris"):AddItem(h, 2)
end
items[i].BuyButton.MouseButton1Click:connect(buy)
end
OUTPUT OF ROBLOX STUDIO
21:12:22.519 - Auto-Saving...
21:12:50.736 - Unknown object class "Workspace" while reading XML
21:12:50.737 - Unknown object class "Players" while reading XML
21:12:50.863 - Unknown object class "StarterGui" while reading XML
21:12:50.864 - Unknown object class "StarterPack" while reading XML
21:12:50.864 - Unknown object class "Debris" while reading XML
21:12:51.089 - Plugin_142315402.1.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.090 - Script 'Plugin_142315402.1.Shop', Line 1
21:12:51.091 - Plugin_142315402.2.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.092 - Script 'Plugin_142315402.2.Shop', Line 1
21:12:51.093 - Plugin_142315402.3.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.094 - Script 'Plugin_142315402.3.Shop', Line 1
21:12:51.095 - Plugin_142315402.4.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.096 - Script 'Plugin_142315402.4.Shop', Line 1
21:12:51.096 - Plugin_142315402.5.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.097 - Script 'Plugin_142315402.5.Shop', Line 1
21:12:51.098 - Plugin_142315402.6.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.098 - Script 'Plugin_142315402.6.Shop', Line 1
21:12:51.099 - Plugin_142315402.7.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.100 - Script 'Plugin_142315402.7.Shop', Line 1
21:12:51.101 - Plugin_142315402.Close.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.102 - Script 'Plugin_142315402.Close.Shop', Line 1
21:12:51.103 - Plugin_142315402.Open.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.104 - Script 'Plugin_142315402.Open.Shop', Line 1
21:12:51.105 - ItemName is not a valid member of TextButton
21:12:51.106 - Script 'Plugin_142315402.Shop Gui.Main.Close.Shop', Line 2
21:12:51.107 - ItemName is not a valid member of TextButton
21:12:51.107 - Script 'Plugin_142315402.Shop Gui.Main.Open.Shop', Line 2
21:12:51.110 - Plugin_142315402.Main.4.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.110 - Script 'Plugin_142315402.Main.4.Shop', Line 1
21:12:51.111 - Plugin_142315402.Main.3.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.112 - Script 'Plugin_142315402.Main.3.Shop', Line 1
21:12:51.113 - Plugin_142315402.Main.1.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.114 - Script 'Plugin_142315402.Main.1.Shop', Line 1
21:12:51.115 - Plugin_142315402.Main.Close.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.116 - Script 'Plugin_142315402.Main.Close.Shop', Line 1
21:12:51.117 - Plugin_142315402.Main.Open.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.118 - Script 'Plugin_142315402.Main.Open.Shop', Line 1
21:12:51.119 - Plugin_142315402.Main.5.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.120 - Script 'Plugin_142315402.Main.5.Shop', Line 1
21:12:51.120 - Plugin_142315402.Main.6.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.121 - Script 'Plugin_142315402.Main.6.Shop', Line 1
21:12:51.122 - Plugin_142315402.Main.7.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.123 - Script 'Plugin_142315402.Main.7.Shop', Line 1
21:12:51.124 - Plugin_142315402.Main.2.Shop:1: attempt to index field 'Parent' (a nil value)
21:12:51.125 - Script 'Plugin_142315402.Main.2.Shop', Line 1
21:12:51.158 - pickitems is not a valid member of ScreenGui
21:12:51.159 - Script 'Plugin_291328554.KinqStudioPlugin', Line 59
21:12:51.161 - nameofdagui is not a valid member of Workspace
21:12:51.162 - Script 'Plugin_291328554.KinqStudioPlugin.KinqStudioPluginShop.Script', Line 1
21:12:57.059 - Script 'Plugin_291328554.KinqStudioPlugin.KinqStudioPluginShop.Inventory.gui3d.LocalScript', Line 4
21:12:57.060 - Stack End
21:12:57.061 - Part is not a valid member of Lighting
21:12:57.062 - Script 'Plugin_291328554.KinqStudioPlugin.KinqStudioPluginShop.Shop.gui3d.LocalScript', Line 4
21:13:42.004 - Players.Player.PlayerGui.WeaponShopGUI.TextLabel.BuyScript:10: attempt to index a nil value
21:13:42.005 - Stack Begin
21:13:42.006 - Script 'Players.Player.PlayerGui.WeaponShopGUI.TextLabel.BuyScript', Line 10
21:13:42.006 - Stack End
21:13:44.352 - Players.Player.PlayerGui.WeaponShopGUI.TextLabel.BuyScript:10: attempt to index a nil value
21:13:44.353 - Stack Begin
21:13:44.353 - Script 'Players.Player.PlayerGui.WeaponShopGUI.TextLabel.BuyScript', Line 10
21:13:44.354 - Stack End

1 comment
You've officially re-posted this same question 4 times. Please take some time to learn about the components that make up this script, instead of posting code you did not make in hope for a revision. This is not a request site.