What it should do is when you say ssj it changes your walkspeed and health, and when you say off it changes it back to normal.
local Player = game.Players.LocalPlayer function ssj(msg) ssj = false if msg == "ssj" and ssj == false then ssj = true Player.Character.Humanoid.WalkSpeed = 60 Player.Character.Humanoid.MaxHealth = 120 end end function off(msg) if ssj == false and msg == "ssj" then ssj = false Player.Character.Humanoid.WalkSpeed = 16 Player.Character.Humanoid.MaxHealth = 100 end end script.Parent.Parent.Chatted:connect(ssj) script.Parent.Parent.Chatted:connect(off)
Error: Players.ggggyourface23.Backpack:6:attempt to index upvalue 'Player' ( a nil value ) line:4
The error itself confused me so I looked at the line number it gave. It is giving you an error because WalkSpeed is not a valid member of the player's character. What you need to do is add .Humanoid before .WalkSpeed.
Also, you can make the script more efficient and have less functions by putting it all into one function and by using an anonymous function, like this:
local Player = game.Players.LocalPlayer ssj = false --Putting the variable outside of the function so we can access it anywhere in the script. Player.Chatted:connect(function(msg) --Anonymous function so you don't need the connect line for the function to fire when the event occurs. if msg == "ssj" and ssj == false then --If ssj is false and the message is ssj then. ssj = true Player.Character.Humanoid.WalkSpeed = 60 Player.Character.Humanoid.MaxHealth = 120 elseif ssj == true and msg == "ssj" then --Elseif ssj is true and the message is ssj then. ssj = false Player.Character.Humanoid.WalkSpeed = 16 Player.Character.Humanoid.MaxHealth = 100 end end) --The bracket after the end closes the anonymous function.