Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Capacity value not changing even though event is fired correctly with no errors?

Asked by
OldBo5 30
5 years ago
game.ReplicatedStorage.ShopBuyBackpack.OnServerEvent:Connect(function(player,page)
local item = player:WaitForChild("PlayerGui"):WaitForChild("ShopBackpack"):WaitForChild("Item")
local shop = game.Workspace.ShopBackpack
local capacity = shop:FindFirstChild("Part"..item.Value).Capacity
player.hiddendatastats.maxCapacity.Value = capacity.Value
end)

purchase button script portions:

local plr = game.Players.LocalPlayer
local money = plr:WaitForChild("leaderstats").Money
local item = plr:WaitForChild("PlayerGui").ShopBackpack.Item
local shop = game.Workspace:WaitForChild("ShopBackpack")
script.Parent.Text = "Bought"
game.ReplicatedStorage.BuyBackpack:FireServer(item.Value)

So whenever I buy the other backpack I have for $50 which has 25 capacity, I still have 10 capacity and my money is taken away. I've been trying to figure this out for almost half an hour.

0
Have you tried printing the value "shop:FindFirstChild("Part"..item.Value).Capacity"? Check the value on both the clients and servers side. Marmalados 193 — 5y

Answer this question