My shop gui still won’t work I got help and everything worked but the tool
The tool will not go in my inventory
I did this website and google and developer hub
I did everything I could I can’t figure it out
-- LocalScript
local Tools = game.ReplicatedStorage:WaitForChild("Tools")
local player = game:GetService("Players").LocalPlayer
local remoteEvent = game.ReplicatedStorage:WaitForChild("Events"):WaitForChild("BuyItemEvent")
local function buyItem()
remoteEvent:FireServer("Laser Gun")
script.Parent.Bought.BackgroundColor3 = Color3.fromRGB(0,255,0)
end
script.Parent.MouseButton1Click:Connect(buyItem)
-- ServerScript
local Tools = game.ReplicatedStorage:WaitForChild("Tools")
local LaserGun = Tools:WaitForChild("Laser Gun")
game.ReplicatedStorage.Events.BuyItemEvent.OnServerEvent:Connect(function(player, tool)
if tool == "Laser Gun" then
if player.leaderstats.Cash.Value >= 350 then
local itemClone = LaserGun:Clone()
itemClone.Parent = player:WaitForChild("Backpack")
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 350
return nil
end
end
end)
2 things, why check for just laser gun? That would take more if statements, try all at once. 2. Wouldn’t you want it to go to backpack AND startergear?