I am currently working on a game called "Pet Rock Sim" and I am looking into making a shop to buy your pets.The way you buy a pet is simply click on a dedicated button for it, but I don't know how to make that button only fire when you have a certain amount of cash.
Add the RemoteEvent to the ReplicateStorage.
-- Script --// Variables local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent") --// Remote Event RemoteEvent.OnServerEvent:Connect(function(plr, Price) if plr and Price then local Points = plr:FindFirstChild("leaderstats"):FindFirstChild("Points").Value if Points then if Points >= Price then plr:FindFirstChild("leaderstats"):FindFirstChild("Points").Value = plr:FindFirstChild("leaderstats"):FindFirstChild("Points").Value - Price print(Points) print(Price) RemoteEvent:FireClient(plr) end end end end) -- Local Script --// Variables local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent") local Button = script.Parent:WaitForChild("TextButton") --// Settings local Price = 100 local plr = game.Players.LocalPlayer --// Button Event Button.MouseButton1Click:Connect(function() RemoteEvent:FireServer(Price) end) --// RemoteEvent RemoteEvent.OnClientEvent:Connect(function(plr) print("Successfully") end)