Im making a gun for myself and have a mode setup however the piece of my code that should switch the mode / value of the StringValue of my gun doesn't seem to want to change it, is this because its a LocalScript or have I just messed up the coding help please. The code includes when I repeatedly press the key "z" it cycles through modes but it stays on the damaging mode.
local mode = script.Parent.Modes.Mode.Value
if key == "z" and reloading == false and firing == false then
if mode == "Damaging" then
mode = "Stun"
print("Stun")
elseif mode == "Stun" then
mode = "Poison"
print("Poison")
elseif mode == "Poison" then
mode = "Damaging"
print("Damaging")
else
mode = nil
end
end

1 comment
I explained that it wouldn't swap. There's no errors its just trashy coding, the location of the script is in a gun tool.