Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

GunShop GUI problem not solved? Help please

Asked by
Krlos21 45
10 years ago
Player=script.Parent.Parent.Parent.Parent.Parent
script.Parent.Text=tostring(script.Parent.ItemName.Value)..": "..tonumber(script.Parent.Cost.Value).." "..tostring(script.Parent.Currency.Value)
script.Parent.MouseButton1Click:connect(function()
if Player:findFirstChild("leaderstats") then
if Player.leaderstats[script.Parent.Currency.Value].Value>=tonumber(script.Parent.Cost.Value) then
Player.leaderstats[script.Parent.Currency.Value].Value=Player.leaderstats[script.Parent.Currency.Value].Value-tonumber(script.Parent.Cost.Value)
game.Lighting[script.Parent.ItemName.Value]:Clone().Parent=Player.Backpack
game.Lighting[script.Parent.ItemName.Value]:Clone().Parent=Player.StarterGear
end
end
end)

This script is inside a GUI set up like this {ScreenGUI--Scrolling Frame-- ImageButtons} the image buttons contain 1 NumberValue for the cost and 2 StringValues for Currency and Item name... BASICALLY what I want this script to do is once you click the Imagebutton it gives you the item in the button... the item is placed in lightning and the above script is inside the ImageButtons BUT it does not work :( BEFORE it worked with textbuttons but decided to change to imagebuttons to make it a little nicer but it wont work now I've gone through everything spelling,functions,script set up. but no luck since I am a beginner to this and someone fixed this script for me before when it had the textbuttons I've tried it all and no success please help I will tank you a lot for it :)

Answer this question