I need help with a Fighting Simulator I'm making. It always gives the starter sword when you upgrade the sword. Here's a few parts of the script that might be incorrect:
AutoUpdate coroutine:
local c2 = coroutine.wrap(function() -- AutoUpdate Sword while wait() do for _,i in pairs(tools)do if i.Name == currentSword then sword = i.Tool end wait() end end end) c2()
CharacterAdded function:
plr.CharacterAdded:connect(function(char) wait() local newSword = sword:Clone() newSword.Parent = plr.Backpack newSword.Activated:Connect(function() if atkDebounce == false then atkDebounce = true if newSword.Name=="Rusty Sword"then jm.Value = jm.Value + 1 elseif newSword.Name=="Wooden Sword"then jm.Value = jm.Value + 2 elseif newSword.Name=="Metal Sword"then jm.Value = jm.Value + 4 elseif newSword.Name=="Ruby Sword"then jm.Value = jm.Value + 6 elseif newSword.Name=="Diamond Sword"then jm.Value = jm.Value + 10 elseif newSword.Name=="Demonic Sword"then jm.Value = jm.Value + 15 elseif newSword.Name=="Godly Sword"then jm.Value = jm.Value + 20 elseif newSword.Name=="Infinity Sword"then jm.Value = jm.Value + 50 end wait(1) atkDebounce = false end end) end)
Sword Variable Update (when upgrading sword):
if currentSword=="Rusty Sword"then currentSword="Wooden Sword"elseif currentSword=="Wooden Sword"then currentSword="Metal Sword"elseif currentSword=="Metal Sword"then currentSword="Ruby Sword"elseif currentSword=="Ruby Sword"then currentSword="Diamond Sword"elseif currentSword=="Diamond Sword"then currentSword="Demonic Sword"elseif currentSword=="Demonic Sword"then currentSword="Godly Sword"elseif currentSword=="Godly Sword"then currentSword="Infinity Sword"end
Please help me out! Many people are waiting for this project to be done, and I'm rushing to get it done!
You can always ask me for the full function in the comments. :)