i have been workin on a simulator for a while, but when i came to the storage full gui pops up part i couldnt make it here’s the script.
local Currency = player.leaderstats.Eggs.Value
local Storage = player.BackpackShop.BackpackV.Value
if player.Currency == player.Storage then
player.PlayerGui.StorageFullGui.MainStorageFrame.Visible = true
wait(0.1)
end
end)
i really tried my best to fix this issue but it didnt work by any chance!
could someone pls explain why is it not workin, and if u help me i appreciate that!
Make a LocalScript, put it inside of StarterGui and type this:
local player = game.Players.LocalPlayer
local Currency = player.leaderstats.Eggs
local Storage = player.BackpackShop.BackpackV
Currency.Changed:Connect(function()
if Currency.Value == Storage.Value then
player.PlayerGui.StorageFullGui.MainStorageFrame.Visible = true
end
end)
Part of the initial problem is that you’re attempting to use variables to shorthand writing things out. player.Currency will literally try to find an object named Currency under the player rather than use the variable you declared earlier.
Remove player from either variable and you should be fine. I don’t know whether your logic is also enclosed in a Changed event or not, but assuming that you’ve only taken the snippet out of a larger segment of running code, what you did is fine but requires changes.
Here is your same provided code with applied changes.
local Currency = player.leaderstats.Eggs.Value
local Storage = player.BackpackShop.BackpackV.Value
if Currency == Storage then
player.PlayerGui.StorageFullGui.MainStorageFrame.Visible = true
wait(0.1)
end
end)
Just a reminder that your declarations hold the value of the ValueObjects at assignment. If you want a fluid value, remove the .Value part from the declaration and add it to the logic comparison below.