local repStorage = game:GetService("ReplicatedStorage")
local Banana = game.Workspace.Banana
local bananaPrompt = Banana.BananaPrompt
local bananaPurchased = repStorage.BananaPurchased
bananaPurchased.Event:Connect(function()
local gold = player.leaderstats.Gold
if gold.Value >= 10 then
gold.Value = gold.Value - 10
Banana:Clone().Parent = player.Backpack
end
end)
becomes
local repStorage = game:GetService("ReplicatedStorage")
local Banana = game.Workspace.Banana
local bananaPrompt = Banana.BananaPrompt
local bananaPurchased = repStorage.BananaPurchased
bananaPurchased.Event:Connect(function(player)
local gold = player.leaderstats.Gold
if gold.Value >= 10 then
gold.Value = gold.Value - 10
Banana:Clone().Parent = player.Backpack
end
end)
gold isnt a value inside leaderstats
this is because its stored in the object player instead of the Players service
show me leaderstats script
(30char)
its nothing wrong with the leaderstats at all
you never store values inside Players service but ok
change
local repStorage = game:GetService("ReplicatedStorage")
local Banana = game.Workspace.Banana
local bananaPrompt = Banana.BananaPrompt
local bananaPurchased = repStorage.BananaPurchased
bananaPurchased.Event:Connect(function(player)
local gold = player.leaderstats.Gold
if gold.Value >= 10 then
gold.Value = gold.Value - 10
Banana:Clone().Parent = player.Backpack
end
end)
to
local repStorage = game:GetService("ReplicatedStorage")
local Banana = game.Workspace.Banana
local bananaPrompt = Banana.BananaPrompt
local bananaPurchased = repStorage.BananaPurchased
bananaPurchased.Event:Connect(function(player)
local gold = player.Gold
if gold.Value >= 10 then
gold.Value = gold.Value - 10
Banana:Clone().Parent = player.Backpack
end
end)
i dont store values in Players service I stored it in player the object
you should never store values in the players service
‘player’ is the player object, not the service
you dont understand, I have it in the specified player’s folder called leaderstats which has gold as an int value in there
the output says gold is not a member of leaderstats,
please show me leaderstats script
bro am i bugging why did i name it gold instead of cash
1 Like
i changed that bug and now its not giving me an error but it still doesnt work, when you go to the prompt and press it it doesnt give you the banana and it just stays there
show me all three scripts (not pictures)
and output (picture)
output has nothing in it, heres the shopHandler located in SSS
heres the script inside the prx prompt