✓ Accepted answer
Hi, Lordmunga!
So I will give you some examples in common situations.
If statements:
So, let's say you have prepared a shop and some leader stats. You can put this script inside the button.
local Button = script.Parent
Button.MouseButton1Click:Connect(function (Player)
if Player.leaderstats.Money == 10 then
print("Successfully purchased!")
end
end)
Elseif:
So, what if the money is not enough? This is where elseif and else come in.
local Button = script.Parent
Button.MouseButton1Click:Connect(function (Player)
if Player.leaderstats.Money == 10 then
print("Successfully purchased!")
elseif
Player.leaderstats.Money < 10 then
print("Insufficient funds")
end
end)
While loops:
Let's say you want to spawn a part every second in the same place. You could use while loops.
while true do
local Part = Instance.new("Part", workspace)
Part.BrickColor = BrickColor.new("Bright blue")
end
Thanks for reading until the end.
If I helped don't forget to accept the answer!
2 comments
Use code blocks.
u suck my nuts thats how and when? 5 minutes or more, even if i splooj early