Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Will this work?

Asked by 9 years ago

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
0
Should work. Why don't you just test it in online mode, to see if it works for yourself? Perci1 4988 — 9y
0
Humanoid.J? xImmortalChaos 565 — 9y
0
@Perci1, Thanks for your prediction. Sadly, all my spaces have been accumulated and there won't be enough space to publish the Alpha version on ROBLOX. fahmisack123 385 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago
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.

0
Thanks! fahmisack123 385 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

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
0
Would this avoid disconnection from servers? fahmisack123 385 — 9y
0
Yes, since when a player leaves the game it would delete the player including the local script. xImmortalChaos 565 — 9y

Answer this question