So I’m making a Shop system, but whenever you click the button, it gives another tool but not the one that the one showed in the text. It’s a little confusing, here’s a snippet of my script and video on what’s happening:
-- Server Script
local boughtShop = game.ReplicatedStorage:WaitForChild("boughtShop")
local tool = game.ServerStorage:WaitForChild("Tools")
local currentTool = game.ReplicatedStorage:WaitForChild("CurrentTool") -- Value of currentTool is set to 1 and is updated everytime you click the next image gui
boughtShop.OnServerEvent:Connect(function(plr)
local ClonedTool = tool:FindFirstChild(workspace:FindFirstChild("item"..currentTool.Value).ItemName.Value):Clone()
ClonedTool.Parent = plr.Backpack
ClonedTool.Handle.Anchored = false
ClonedTool.Name = workspace:FindFirstChild("item"..currentTool.Value).ItemName.Value
end)
.