How to invoke server multiple times in a script
primarySelectedItem:GetPropertyChangedSignal("Value"):Connect(function()
wait(.1)
*local result = game.ReplicatedStorage.PurchaseItem:InvokeServer(primarySelectedItem.Value)*
if result == true then
primaryBuyButton.Text = "Equip"
primaryBuyButton.BackgroundColor3 = Color3.fromRGB(55, 193, 55)
elseif result == "NotEnoughBucks" then
primaryBuyButton.BackgroundColor3 = Color3.fromRGB(204, 31, 31)
primaryBuyButton.Text = "Not Enough bucks!"
primarySelectedItem.Value = primarySelectedItem.Value
wait(.3)
primaryBuyButton.Text = "Buy"
primarySelectedItem.Value = primarySelectedItem.Value
primaryBuyButton.BackgroundColor3 = Color3.fromRGB(55, 193, 55)
elseif result == "Equipped" then
primaryEquippedItem.Value = primarySelectedItem.Value
primaryBuyButton.BackgroundColor3 = Color3.fromRGB(42, 149, 42)
primaryBuyButton.Text = "Equipped"
end
end)
primaryBuyButton.MouseButton1Click:Connect(function()
wait(.1)
*local result = game.ReplicatedStorage.PurchaseItem:InvokeServer(primarySelectedItem.Value)*
if result == true then
primaryBuyButton.Text = "Equip"
primaryBuyButton.BackgroundColor3 = Color3.fromRGB(55, 193, 55)
elseif result == "NotEnoughBucks" then
primaryBuyButton.BackgroundColor3 = Color3.fromRGB(204, 31, 31)
primaryBuyButton.Text = "Not Enough bucks!"
primarySelectedItem.Value = primarySelectedItem.Value
wait(.3)
primaryBuyButton.Text = "Buy"
primarySelectedItem.Value = primarySelectedItem.Value
primaryBuyButton.BackgroundColor3 = Color3.fromRGB(55, 193, 55)
elseif result == "Equipped" then
primaryEquippedItem.Value = primarySelectedItem.Value
primaryBuyButton.BackgroundColor3 = Color3.fromRGB(42, 149, 42)
primaryBuyButton.Text = "Equipped"
end
end)