You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I am trying to make a shop using seconds in the game -
What is the issue? Include screenshots / videos if possible!
The issue is when i try buying stuff it says attempt to compare Instance <= number -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried to replace the price value with just the number, still nothing, ive placed the price from one place to other, still nothing.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
ServerScriptService:
game.ReplicatedStorage.Buy.OnServerEvent:Connect(function(player, price, item)
if player.leaderstats.Seconds.Value >= price then
player.leaderstats.Seconds.Value = player.leaderstats.Seconds.Value - price
local clone = game.ServerStorage.Tools:FindFirstChild(item):Clone()
clone.Parent = player.Backpack
else
error("Couldnt buy item")
end
end)
LocalScript:
local player = game.Players.LocalPlayer
local item = "Slurpee"
local price = 150
local debounce = false
script.Parent.MouseButton1Click:Connect(function()
if player.leaderstats.Seconds.Value >= price then
if debounce == false then
debounce = true
script.Parent.Click:Play()
game.ReplicatedStorage.Buy:FireServer(player, price, item)
wait(2)
debounce = false
end
else
script.Parent.Error:Play()
end
end)