Okay I tried this method and the output said
tostring is not a valid member of Folder "ServerStorage.Items"
Okay I tried this method and the output said
tostring is not a valid member of Folder "ServerStorage.Items"
try this
local CostOfItem = ItemFolder:FindFirstChild(Item).Cost
does the bug of the currency being subtracted multiple times still happens?
It stopped time to test for running more than once
This bug still happens
(30 words requirement)
what does that mean?
try to print the value of thePurchasedItem.Value after the FireServer code and tell me the output
– print it in the local script
Well in the local script if I print yes when the buybuttion is clicked once it prints 12 times
i mean print the value of the variable that determines if the item is bought
PurchasedItem.Value == false -- print the value of that variable
It prints false when the item is not purchased and it prints true if the items is purchased however the prints still comes out 12 times per click instead of 1
how many times did it print true?
the same number of times
(30 words requirement)
i mean it should print false or true how many times was false/true printed
as if the script ran 13 times and the value is false then it should only fire once
can u send the output ?
false (x24)
The reason why its all false is because it printed before the purchase was finished
can u replace it with this code just for testing and tell me if it subtracted the value multiple times and copy the whole output and send it here
if IsAItemSelectedValue.Value == true and PurchasedItem.Value == false and PressedButtion:GetAttribute("TypeofButtion") == "Item" then
ButtionCooldown = true
print(PurchasedItem.Value)
if PurchasedItem.Value == false then return end
BuyItemEvent:FireServer(PressedButtion.ItemThatTheButtionsells)
task.wait(0.2)
-- the rest of ur script
i mean if it was false and not true then it should have only fired 1 time bc of the if statment
It prints more than once
Here is the code for the buybuttion
BuyButtion.MouseButton1Click:Connect(function()
print(PurchasedItem.Value)
if ButtionCooldown == false then
ButtionCooldown = true
if PurchasedItem.Value == false and IsAItemSelectedValue.Value == true and PressedButtion:GetAttribute("TypeofButtion") == "Item" then
ButtionCooldown = true
print(PurchasedItem.Value)
if PurchasedItem.Value == false then return end
BuyItemEvent:FireServer(PressedButtion.ItemThatTheButtionsells)
if PurchasedItem.Value == true then
BuyButtion.Text = "Item Purchased!"
task.wait(2)
BuyButtion.Text = "You already purchased a item you can't purchase another one!"
else
ButtionCooldown = true
BuyButtion.Text = "Not Enough BaldiCoins!"
task.wait(2)
BuyButtion.Text = "Buy item"
ButtionCooldown = false
end
task.wait(1)
ButtionCooldown = false
elseif PurchasedPerk.Value == false and IsAItemSelectedValue.Value == true and PressedButtion:GetAttribute("TypeofButtion") == "Perk" then
ButtionCooldown = true
BuyPerkEvent:FireServer(PressedButtion.PerkThatTheButtionsells.Value)
task.wait(0.2)
if PurchasedPerk.Value == true then
BuyButtion.Text = "Perk Purchased!"
task.wait(2)
BuyButtion.Text = "You already purchased a Perk you can't purchase another one!"
else
ButtionCooldown = true
BuyButtion.Text = "Not Enough BaldiCoins!"
task.wait(2)
BuyButtion.Text = "Buy Perk"
ButtionCooldown = false
end
task.wait(1)
ButtionCooldown = false
end
task.wait(0.5)
ButtionCooldown = false
end
end)
ik that it will print more than once i want to see the full output logs that it printed copy and paste them here and try to use it with cash and see if it subtracted it more than once
This is what the output printed for the local script
false - Client - MainShopScript:86
15:29:12.031 false - Client - MainShopScript:91
15:29:12.032 false - Client - MainShopScript:86
15:29:12.032 false - Client - MainShopScript:91
15:29:12.032 false - Client - MainShopScript:86
15:29:12.032 false - Client - MainShopScript:91
15:29:12.032 false - Client - MainShopScript:86
15:29:12.032 false - Client - MainShopScript:91
15:29:12.033 false - Client - MainShopScript:86
15:29:12.033 false - Client - MainShopScript:91
15:29:12.033 false - Client - MainShopScript:86
15:29:12.033 false - Client - MainShopScript:91
15:29:12.033 false - Client - MainShopScript:86
15:29:12.033 false - Client - MainShopScript:91
15:29:12.034 false - Client - MainShopScript:86
15:29:12.034 false - Client - MainShopScript:91
15:29:12.034 false - Client - MainShopScript:86
15:29:12.034 false - Client - MainShopScript:91
15:29:12.035 false - Client - MainShopScript:86
15:29:12.035 false - Client - MainShopScript:91
15:29:12.035 false - Client - MainShopScript:86
15:29:12.035 false - Client - MainShopScript:91
15:29:12.036 false - Client - MainShopScript:86
15:29:12.036 false - Client - MainShopScript:91
15:29:12.793 ▶ false (x36) - Client - MainShopScript:86
and this is what it printed for the server side script
argument #1 expects a string, but Instance was passed - Server - ShopScript (ServerSide):19
15:34:59.463 Stack Begin - Studio
15:34:59.463 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.464 Stack End - Studio
15:34:59.466 ServerScriptService.ShopScript (ServerSide):19: attempt to index nil with 'Cost' - Server - ShopScript (ServerSide):19
15:34:59.467 Stack Begin - Studio
15:34:59.467 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.468 Stack End - Studio
15:34:59.519 argument #1 expects a string, but Instance was passed - Server - ShopScript (ServerSide):19
15:34:59.520 Stack Begin - Studio
15:34:59.520 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.520 Stack End - Studio
15:34:59.521 ServerScriptService.ShopScript (ServerSide):19: attempt to index nil with 'Cost' - Server - ShopScript (ServerSide):19
15:34:59.521 Stack Begin - Studio
15:34:59.522 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.522 Stack End - Studio
15:34:59.524 argument #1 expects a string, but Instance was passed - Server - ShopScript (ServerSide):19
15:34:59.525 Stack Begin - Studio
15:34:59.526 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.526 Stack End - Studio
15:34:59.527 ServerScriptService.ShopScript (ServerSide):19: attempt to index nil with 'Cost' - Server - ShopScript (ServerSide):19
15:34:59.527 Stack Begin - Studio
15:34:59.527 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.528 Stack End - Studio
15:34:59.546 argument #1 expects a string, but Instance was passed - Server - ShopScript (ServerSide):19
15:34:59.547 Stack Begin - Studio
15:34:59.548 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.548 Stack End - Studio
15:34:59.549 ServerScriptService.ShopScript (ServerSide):19: attempt to index nil with 'Cost' - Server - ShopScript (ServerSide):19
15:34:59.550 Stack Begin - Studio
15:34:59.551 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.552 Stack End - Studio
15:34:59.552 argument #1 expects a string, but Instance was passed - Server - ShopScript (ServerSide):19
15:34:59.552 Stack Begin - Studio
15:34:59.553 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.554 Stack End - Studio
15:34:59.556 ServerScriptService.ShopScript (ServerSide):19: attempt to index nil with 'Cost' - Server - ShopScript (ServerSide):19
15:34:59.556 Stack Begin - Studio
15:34:59.557 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.557 Stack End - Studio
15:34:59.574 argument #1 expects a string, but Instance was passed - Server - ShopScript (ServerSide):19
15:34:59.575 Stack Begin - Studio
15:34:59.577 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.578 Stack End - Studio
15:34:59.578 ServerScriptService.ShopScript (ServerSide):19: attempt to index nil with 'Cost' - Server - ShopScript (ServerSide):19
15:34:59.579 Stack Begin - Studio
15:34:59.580 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.580 Stack End - Studio
15:34:59.582 argument #1 expects a string, but Instance was passed - Server - ShopScript (ServerSide):19
15:34:59.582 Stack Begin - Studio
15:34:59.583 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.584 Stack End - Studio
15:34:59.586 ServerScriptService.ShopScript (ServerSide):19: attempt to index nil with 'Cost' - Server - ShopScript (ServerSide):19
15:34:59.588 Stack Begin - Studio
15:34:59.588 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.590 Stack End - Studio
15:34:59.616 argument #1 expects a string, but Instance was passed - Server - ShopScript (ServerSide):19
15:34:59.617 Stack Begin - Studio
15:34:59.618 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.619 Stack End - Studio
15:34:59.620 ServerScriptService.ShopScript (ServerSide):19: attempt to index nil with 'Cost' - Server - ShopScript (ServerSide):19
15:34:59.621 Stack Begin - Studio
15:34:59.621 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.621 Stack End - Studio
15:34:59.623 argument #1 expects a string, but Instance was passed - Server - ShopScript (ServerSide):19
15:34:59.623 Stack Begin - Studio
15:34:59.625 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.626 Stack End - Studio
15:34:59.626 ServerScriptService.ShopScript (ServerSide):19: attempt to index nil with 'Cost' - Server - ShopScript (ServerSide):19
15:34:59.627 Stack Begin - Studio
15:34:59.628 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.629 Stack End - Studio
15:34:59.646 argument #1 expects a string, but Instance was passed - Server - ShopScript (ServerSide):19
15:34:59.647 Stack Begin - Studio
15:34:59.647 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.647 Stack End - Studio
15:34:59.648 ServerScriptService.ShopScript (ServerSide):19: attempt to index nil with 'Cost' - Server - ShopScript (ServerSide):19
15:34:59.649 Stack Begin - Studio
15:34:59.649 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.649 Stack End - Studio
15:34:59.650 argument #1 expects a string, but Instance was passed - Server - ShopScript (ServerSide):19
15:34:59.650 Stack Begin - Studio
15:34:59.651 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.651 Stack End - Studio
15:34:59.651 ServerScriptService.ShopScript (ServerSide):19: attempt to index nil with 'Cost' - Server - ShopScript (ServerSide):19
15:34:59.651 Stack Begin - Studio
15:34:59.652 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.652 Stack End - Studio
15:34:59.653 argument #1 expects a string, but Instance was passed - Server - ShopScript (ServerSide):19
15:34:59.653 Stack Begin - Studio
15:34:59.653 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.654 Stack End - Studio
15:34:59.655 ServerScriptService.ShopScript (ServerSide):19: attempt to index nil with 'Cost' - Server - ShopScript (ServerSide):19
15:34:59.655 Stack Begin - Studio
15:34:59.656 Script 'ServerScriptService.ShopScript (ServerSide)', Line 19 - Studio - ShopScript (ServerSide):19
15:34:59.657 Stack End - Studio
ok i think am done testing try to replace it with this script now i hope it works well
BuyButtion.MouseButton1Click:Connect(function()
print(PurchasedItem.Value)
if ButtionCooldown == false then
ButtionCooldown = true
if PurchasedItem.Value == false and IsAItemSelectedValue.Value == true and PressedButtion:GetAttribute("TypeofButtion") == "Item" then
PurchasedItem.Value = true
ButtionCooldown = true
print(PurchasedItem.Value)
BuyItemEvent:FireServer(PressedButtion.ItemThatTheButtionsells)
if PurchasedItem.Value == true then
BuyButtion.Text = "Item Purchased!"
task.wait(2)
BuyButtion.Text = "You already purchased a item you can't purchase another one!"
else
ButtionCooldown = true
BuyButtion.Text = "Not Enough BaldiCoins!"
task.wait(2)
BuyButtion.Text = "Buy item"
ButtionCooldown = false
end
task.wait(1)
ButtionCooldown = false
elseif PurchasedPerk.Value == false and IsAItemSelectedValue.Value == true and PressedButtion:GetAttribute("TypeofButtion") == "Perk" then
ButtionCooldown = true
BuyPerkEvent:FireServer(PressedButtion.PerkThatTheButtionsells.Value)
task.wait(0.2)
if PurchasedPerk.Value == true then
BuyButtion.Text = "Perk Purchased!"
task.wait(2)
BuyButtion.Text = "You already purchased a Perk you can't purchase another one!"
else
ButtionCooldown = true
BuyButtion.Text = "Not Enough BaldiCoins!"
task.wait(2)
BuyButtion.Text = "Buy Perk"
ButtionCooldown = false
end
task.wait(1)
ButtionCooldown = false
end
task.wait(0.5)
ButtionCooldown = false
end
end)
if it worked well then u can remove the print that i added
and make sure that ur folder in SS have a child named Cost as ur getting errors of that not existing
All the errors stopped time for testing
ok nice test it and if it subtracted the value once and worked well then tell me
and replace ur local script with the new one that i sent