So I have this script that will give you a hammer and set Hammer.Value to true etc. But when I set it to true the elseif statement will react because the hammer value is true which causes my code to not work properly. Could someone help me?
local Hammer = game.ReplicatedStorage.Tools.Hammer:Clone()
local Replicator = game.ReplicatedStorage.Replicators.Shop.Purchase_Hammer
local Audio_Ctr = game.ReplicatedStorage.Replicators.Misc.Audio_Controller
local Button = workspace.Shop.Hammer_Item.Purchase_Button
local Purchase_Sound = "Purchase_Sound"
local insufficient_Funds = "Err_Purchasing"
Replicator.OnServerEvent:Connect(function(player)
local Currency = player:WaitForChild("Currency")
local Bits = Currency.Bits
local Own_Hammer = player.ToolStat.Hammer
--<-->--
if Bits.Value >=10 and Own_Hammer.Value == false then
Bits.Value = Bits.Value -10
Hammer.Parent = player.Backpack
Audio_Ctr:FireClient(player,Purchase_Sound)
print("True")
Own_Hammer.Value = true
elseif Bits.Value <=10 or Own_Hammer.Value == true then
print("FALSE")
Audio_Ctr:FireClient(player,insufficient_Funds)
end
end)

1 comment
Thank you! It worked, this saves me a lot of time beacuse i had this problem in the past and i never knew why it wasn't working.