Whenever you buy a pouch the player's currency goes into negatives? I'm not sure why. If I try to get rid of the currency Locally it goes back to the original currency!? There are no errors in the output
Serverscript
game.ReplicatedStorage.ShopEvents.PurchasedWhitePouch.OnServerEvent:Connect(function(player)
local player = player
local Bag = player:FindFirstChild("BagHolder")
local Main = player:FindFirstChild("MainCurrency")
local Coins = Main:FindFirstChild("Coins")
local SmallBag = Bag:FindFirstChild("WhitePouch")
for i,v in pairs(Bag:GetChildren()) do
v.Value = false
SmallBag.Value = true
Main.MaxBlades.Value = 15
end
end)
game.ReplicatedStorage.ShopEvents.PurchasedBluePouch.OnServerEvent:Connect(function(player)
local player = player
local Bag = player:FindFirstChild("BagHolder")
local Main = player:FindFirstChild("MainCurrency")
local BagOwned = player:FindFirstChild("BagOwned")
local OwnerShip = BagOwned:FindFirstChild("BluePouchOwned")
local Coins = Main:FindFirstChild("Coins")
local SmallBag = Bag:FindFirstChild("BluePouch")
for i,v in pairs(Bag:GetChildren()) do
v.Value = false
SmallBag.Value = true
Main.MaxBlades.Value = 50
OwnerShip.Value = true
Coins.Value = Coins.Value - 50
end
end)
game.ReplicatedStorage.ShopEvents.PurchasedGreenPouch.OnServerEvent:Connect(function(player)
local player = player
local Bag = player:FindFirstChild("BagHolder")
local BagOwned = player:FindFirstChild("BagOwned")
local OwnerShip = BagOwned:FindFirstChild("GreenPouchOwned")
local Main = player:FindFirstChild("MainCurrency")
local Coins = Main:FindFirstChild("Coins")
local SmallBag = Bag:FindFirstChild("GreenPouch")
for i,v in pairs(Bag:GetChildren()) do
v.Value = false
SmallBag.Value = true
Main.MaxBlades.Value = 150
OwnerShip.Value = true
Coins.Value = Coins.Value - 150
end
end)
game.ReplicatedStorage.ShopEvents.PurchasedYellowPouch.OnServerEvent:Connect(function(player)
local player = player
local Bag = player:FindFirstChild("BagHolder")
local Main = player:FindFirstChild("MainCurrency")
local Coins = Main:FindFirstChild("Coins")
local SmallBag = Bag:FindFirstChild("YellowPouch")
for i,v in pairs(Bag:GetChildren()) do
v.Value = false
SmallBag.Value = true
Main.MaxBlades.Value = 300
Coins.Value = Coins.Value - 500
end
end)
game.ReplicatedStorage.ShopEvents.PurchasedOrangePouch.OnServerEvent:Connect(function(player)
local player = player
local Bag = player:FindFirstChild("BagHolder")
local Main = player:FindFirstChild("MainCurrency")
local Coins = Main:FindFirstChild("Coins")
local SmallBag = Bag:FindFirstChild("OrangePouch")
for i,v in pairs(Bag:GetChildren()) do
v.Value = false
SmallBag.Value = true
Main.MaxBlades.Value = 750
Coins.Value = Coins.Value - 1500
end
end)
Purchase LocalScript In Button
script.Parent.Activated:Connect(function()
local player = game.Players.LocalPlayer
local Bag = player:FindFirstChild("BagHolder")
local Main = player:FindFirstChild("MainCurrency")
local Coins = Main:FindFirstChild("Coins")
local Price = script.Parent.Parent.Price.Value
local SmallBag = Bag:FindFirstChild("BluePouch")
script.Parent.Click:Play()
if Coins.Value >= Price then
game.ReplicatedStorage.ShopEvents.PurchasedBluePouch:FireServer(player)
Coins.Value = Coins.Value - 50
else
script.Parent.Parent.Frame.Price.TextColor3 = Color3.fromRGB(255, 46, 19)
wait(0.5)
script.Parent.Parent.Frame.Price.TextColor3 = Color3.fromRGB(255, 255, 255)
end
end)

1 comment
Ty, can't believe I didn't notice that lol