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

Filtering enabled bug that stops fire and player flying, or am I doing something wrong?

Asked by 6 years ago

Every single time I use anything with BodyForce or BodyVelocity (Filtering Enabled) there is ALWAYS the same type of bug. The Output and Console says there is no errors.

Right now I'm making flying

Local Script in Player Backpack

workspace.General.Cooldown.Create:FireServer()
workspace.General.ClickDetector.Clicker:FireServer()
UserInput = game:GetService("UserInputService")
workspace:WaitForChild(game.Players.LocalPlayer.Name)
UserInput.InputBegan:connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.LeftAlt or Input.KeyCode == Enum.KeyCode.RightAlt then
        workspace.General.Fly.Up:FireServer()
    end
end)
UserInput.InputEnded:connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.LeftAlt or Input.KeyCode == Enum.KeyCode.RightAlt then
        workspace.General.Fly.Stop:FireServer()
    end
end)
Mouse = game.Players.LocalPlayer:GetMouse()
Mouse.Button1Down:connect(function()
    if game.Players.LocalPlayer.Character.UpperTorso:FindFirstChild("Fly") ~= nil then
        workspace.General.Fly.Move:FireServer()
    end
end)
Mouse.Button1Up:connect(function()
    if game.Players.LocalPlayer.Character.UpperTorso:FindFirstChild("Fly") ~= nil then
        workspace.General.Fly.Stop:FireServer()
    end
end)
UserInput.InputBegan:connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.LeftShift or Input.KeyCode == Enum.KeyCode.RightShift then
        workspace.General.Fly.Fast:FireServer()
    end
end)
UserInput.InputEnded:connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.LeftShift or Input.KeyCode == Enum.KeyCode.RightShift then
        workspace.General.Fly.Slow:FireServer()
    end
end)
UserInput.InputBegan:connect(function(Input)
    if game.Players.LocalPlayer.Character.UpperTorso:FindFirstChild("Fly") ~= nil then
        if Input.KeyCode == Enum.KeyCode.Space then
            workspace.General.Fly.Down:FireServer()
        end
    end
end)
UserInput.InputEnded:connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.Space then
        if game.Players.LocalPlayer.Character.UpperTorso:FindFirstChild("Fly") ~= nil then
            workspace.General.Fly.Stop:FireServer()
        end
    end
end)
game.Players.LocalPlayer.Character.UpperTorso.ChildRemoved:connect(function(Part)
    if Part.Name == "Fly" then
        workspace.General.Fly.StopScript.Stop:FireServer()
    end
end)
function FloatU()
    workspace.General.Fly.Up:FireServer()
end
function Stop()
    if game.Players.LocalPlayer.Character.UpperTorso:FindFirstChild("Fly") ~= nil then
        workspace.General.Fly.Stop:FireServer()
    end
end
function FloatD()
    if game.Players.LocalPlayer.Character.UpperTorso:FindFirstChild("Fly") ~= nil then
        workspace.General.Fly.Down:FireServer()
    end
end
ContextAction = game:GetService("ContextActionService")
local FloatUp = ContextAction:BindAction("FloatUp", FloatU, true)
ContextAction:SetPosition("FloatUp", UDim2.new(1, -50, 0.1, -100))
ContextAction:SetImage("FloatUp", "rbxassetid://1533231301")
local FloatStop = ContextAction:BindAction("FloatStop", Stop, true)
ContextAction:SetPosition("FloatStop", UDim2.new(1, -50, 0.1, -50))
ContextAction:SetImage("FloatStop", "rbxgameasset://Images/Stop")
local FloatDown = ContextAction:BindAction("FloatDown", FloatD, true)
ContextAction:SetPosition("FloatDown", UDim2.new(1, -50, 0.1, 0))
ContextAction:SetImage("FloatDown", "rbxassetid://1535168213")

Script in Workspace > General named Fly:

--[==[ ({ Float Up } ) ]==]--
local Speed = 5
local Idle = false
script.Up.OnServerEvent:connect(function(Client)
    local Char = Client.Character
    if Client.Backpack.Element.Value == "Fire" then
        if Char.UpperTorso:FindFirstChild("Fire") == nil then
            local Flame = workspace.Fire.FireBall["Fire Volley"].Fire:Clone()
            Flame.Parent = Char.UpperTorso
        end
    end
    for i, v in pairs(Char.Humanoid:GetPlayingAnimationTracks()) do
        v:Stop()
    end
    Char.Animate.Disabled = true
    local Anim = Char.Humanoid:LoadAnimation(script.UpAnim)
    Anim:Play()
    Idle = true
    if not Char.UpperTorso:FindFirstChild("Fly") then
        local Fly = Instance.new("BodyVelocity", Char.UpperTorso)
        Fly.Name = "Fly"
        Fly.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
        Fly.Velocity = Vector3.new(0, Speed, 0)
    elseif Char.UpperTorso:FindFirstChild("Fly") then
        local Fly = Char.UpperTorso.Fly
        Fly.Velocity = Vector3.new(0, Speed, 0)
    end
end)
--[==[ ({ Down }) ]==]--
script.Down.OnServerEvent:connect(function(Client)
    local Char = Client.Character
    for i, v in pairs(Char.Humanoid:GetPlayingAnimationTracks()) do
        v:Stop()
        v:remove()
    end
    Char.Animate.Disabled = true
    local Anim = Char.Humanoid:LoadAnimation(script.DownAnim)
    Anim:Play()
    Idle = true
    if Char.UpperTorso:FindFirstChild("Fly") then
        local Fly = Char.UpperTorso.Fly
        Fly.Velocity = Vector3.new(0, Speed * -10, 0)
        for i, v in ipairs(Char:GetChildren()) do
            if v:IsA("MeshPart") then
                v.Touched:connect(function(hit)
                    Fly:Remove()
                    if Char.UpperTorso:FindFirstChild("Fire") ~= nil then
                        Char.UpperTorso.Fire.Enabled = false
                        game:GetService("Debris"):AddItem(Char.UpperTorso.Fire, 5)
                    end
                    Char.Animate.Disabled = false
                end)
            end
        end
    end
end)
--[==[ ({ Move }) ]==]--
script.Move.OnServerEvent:connect(function(Client)
    Idle = false
    local Char = Client.Character
    for i, v in pairs(Char.Humanoid:GetPlayingAnimationTracks()) do
        v:Stop()
        v:remove()
    end
    Char.Animate.Disabled = true
    local Anim = Char.Humanoid:LoadAnimation(script.MoveAnim)
    Anim:Play()
    local Mouse = Client:GetMouse()
    Char.HumanoidRootPart.CFrame = CFrame.new(Char.HumanoidRootPart.Position, Mouse.Hit.p)
    Char.UpperTorso.Fly.Velocity = Char.HumanoidRootPart.CFrame.lookVector * Speed * 10
    Mouse.Move:connect(function()
        if Idle == false then
            Char.HumanoidRootPart.CFrame = CFrame.new(Char.HumanoidRootPart.Position, Mouse.Hit.p)
            Char.UpperTorso.Fly.Velocity = Char.HumanoidRootPart.CFrame.lookVector * Speed * 10
        end
    end)
end)
--[==[ ({ Stop }) ]==]--
script.Stop.OnServerEvent:connect(function(Client)
    local Char = Client.Character
    for i, v in pairs(Char.Humanoid:GetPlayingAnimationTracks()) do
        v:Stop()
    end
    Char.Animate.Disabled = true
    local Anim = Char.Humanoid:LoadAnimation(script.Idle)
    Anim:Play()
    Char.UpperTorso.Fly.Velocity = Vector3.new(0, 0, 0)
    Idle = true
end)
script.Fast.OnServerEvent:connect(function()
    Speed = 25
end)
script.Slow.OnServerEvent:connect(function()
    Speed = 5
end)

Answer this question