I’ve heard somewhere that constant elseif statements are bad, and I would need an array, but since I’m new to scripting, I’d rather just learn this here and use it for my future scripts. It also doesn’t look too pretty… Any help is most appreciated.
Handle.Touched:Connect(function(hit)
if hit.Parent:IsA("Model") and hit.Parent.Name == "Rock" and not on_cooldown then
OreStatus = "Rock"
on_cooldown = true
task.wait(cooldown)
on_cooldown = false
elseif hit.Parent:IsA("Model") and hit.Parent.Name == "IronOre" and not on_cooldown then
OreStatus = "IronOre"
on_cooldown = true
task.wait(cooldown)
on_cooldown = false
elseif hit.Parent:IsA("Model") and hit.Parent.Name == "GoldOre" and not on_cooldown then
OreStatus = "GoldOre"
on_cooldown = true
task.wait(cooldown)
on_cooldown = false
elseif hit.Parent:IsA("Model") and hit.Parent.Name == "AzureOre" and not on_cooldown then
OreStatus = "AzureOre"
on_cooldown = true
task.wait(cooldown)
on_cooldown = false
end
end)