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

I have problem with my commands script (UnFF) Can anyone help me?

Asked by 5 years ago
function OnChatted(msg, speaker)
    local source = string.lower(speaker.Name)
    msg = string.lower(msg)

    --//Commands\\--
    if msg == "/e respawn" then
        speaker:LoadCharacter()
    elseif msg == "/e sparkles" then
        Instance.new("Sparkles", speaker.Character.HumanoidRootPart)
    elseif msg == "/e ff" then
        Instance.new("ForceField", speaker.Character)
    elseif msg == "/e run" then
        speaker.Character.Humanoid.WalkSpeed = 25
    elseif msg == "/e walk" then
        speaker.Character.Humanoid.Walkspeed = 16
    elseif msg == "/e sit" then
        speaker.Character.Humanoid.Sit = true
    end
    end

    game.Players.PlayerAdded:connect(function(player)
        player.Chatted:connect(function(msg) OnChatted(msg, player) end)
    end)

I want to make UnFF but I do not know how,can someone help me?

0
Also,script works pretty well,there are no problems KOMKO190 0 — 5y
0
is it a server script User#23365 30 — 5y
0
The same way you made the sparkles delete them User#19524 175 — 5y
0
dont request for scripts User#23365 30 — 5y

1 answer

Log in to vote
-1
Answered by 5 years ago

sometimes players have multiple force fields on. the for loop gets every forcefield. put this with the other elseif's

 elseif msg == "/e Unff" then
if(speaker.Characater ~= nil)then
    local character = speaker.Character
    local charmod = character:GetChildren()
        for i = 1,#charmod do
            if(charmod[i].ClassName == "ForceField")then
            charmod[i]:Destroy()
        end
    end
end

1
you know you don't need the () n your conditions and the ~= nil is redundant right? and you're just spoon feeding scripts User#19524 175 — 5y
0
Uhm, dear incapaz, what is wrong about "spoon feeding scripts"? AIphanium 124 — 5y
0
He liked to write/copy a script, it was HIS choice, KOMKO190 also gave a script, so, there is nothing wrong about "spoon feeding scripts" in this question. AIphanium 124 — 5y
0
Except that it's the script he provided for his question? TheeDeathCaster 2368 — 5y
0
why did you rate my answer bad for a bad reason :( 129Steve129 7 — 5y
Ad

Answer this question