In my game the characters can throw a fireball wow and the fireball changes depending on their stat. But when i try to do
if player.Stat.Value >= 10^21 then local fireball = game.ReplicatedStorage.Fireballs.Sx:Clone()
elseif player.Stat.Value >= 10^18 then local fireball = game.ReplicatedStorage.Fireballs.Qi:Clone()
etc.
it doesnt localise the fireball. How can i make this work. I dont want to copy and paste the entire code for 7 times.
Guys pls. Am i supposed to create a string value in player backpack and do game.ReplicatedStorage.Fireballs[StringValue.Value]:Clone()
with a scirpt inside the string value updating every second.
You can declare the local variable beforehand and assign the value in the if statement afterwards:
local fireball
if player.Stat.Value >= 10^21 then
fireball = game.ReplicatedStorage.Fireballs.Sx:Clone()
elseif player.Stat.Value >= 10^18 then
fireball = game.ReplicatedStorage.Fireballs.Qi:Clone()
end