Sadly, I can't test this in Studio's Play Solo, since we can not chat there.
What this code is meant to do is, if someone wants to go BRB/AFK, then they chat a certain phrase that should continuously make them jump until they say "I'm back" to stop the jumping and return them to normal.
BRBMode = false game.Players.LocalPlayer.Chatted:connect(function(msg) if msg == "I'll BRB" then BRBMode = true elseif msg == "I'm Back" then BRBMode = false end end) while BRBMode == true do --Did I do this correctly? game.Players.LocalPlayer.Character.Humanoid.Jump = true wait() end
while BRBMode == true then
I'm not sure if that will work considering that the true is used in other while scripts. How about you make it a number instead of a bool?
BRBMode = 1 -- Number for false game.Players.LocalPlayer.Chatted:connect(function(msg) if msg == "I'll BRB" then BRBMode = 2 -- Number for true elseif msg == "I'm Back" then BRBMode = 1 end end) while BRBMode == 2 do --Did I do this correctly? game.Players.LocalPlayer.Character.Humanoid.Jump = true wait() end
That should work better.
This might be more efficient
--when going brb Instance.new("ForceField" game.Players.LocalPlayer.Character) -- Creates a ForceField for the player, Instance.new allies you to create items. --Coming back from AFK for I,v in pairs(game.Players.LocalPlayer.Character:GetChildren()) do --Fetches all items in the player if v:IsA("ForceField") then --sees if any object is the ForceField we made v:Destroy() end end