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)
Here's the code in each Item button, I know there aren't any typos with the number/string values and the gear is in lighting where it needs to be. Any ideas guys? Thanks in advance, I'll probably be headed to bed after this.
If you'd like to reach out to me through discord I'd be really grateful, I've got my details on my profile. (You're welcome to stop in just to chat, too.) Stuff in my workspace is set up like this, I don't think there are any problems here but just incase.
Sidenote : My close button also doesn't work, which also confuses me (I'm more concerned with the first issue though.)
print("Close button loaded") button = script.Parent window = script.Parent.Parent function onClicked(GUI) window:remove() end script.Parent.MouseButton1Click:connect(onClicked)
so for the shop button its super easy
local item = game.Lighting.Item ---change lighting to the items parent and item to the items name script.Parent.MouseButton1Click:Connect(function(plr) local l = plr:WaitForChild("leaderstats") if l then local c = l:FindFirstChild("Cash") if c then if c.Value = 50 then --- change 50 to the items price local itemclone = item:Clone() itemclone.Parent = plr.Backpack c.Value = c.Value - 50 end end end end)
hope this helped :3