Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- // Constants \\ --
- -- [ Services ] --
- local Services = setmetatable({}, {__index = function(Self, Index)
- local NewService = game.GetService(game, Index)
- if NewService then
- Self[Index] = NewService
- end
- return NewService
- end})
- -- [ LocalPlayer ] --
- local LocalPlayer = Services.Players.LocalPlayer
- -- // Functions \\ --
- local function PlayerAdded(Player)
- local Detected = false
- local Character;
- local PrimaryPart;
- local function CharacterAdded(NewCharacter)
- Character = NewCharacter
- repeat
- wait()
- PrimaryPart = NewCharacter:FindFirstChild("HumanoidRootPart")
- until PrimaryPart
- Detected = false
- end
- CharacterAdded(Player.Character or Player.CharacterAdded:Wait())
- Player.CharacterAdded:Connect(CharacterAdded)
- Services.RunService.Heartbeat:Connect(function()
- if (Character and Character:IsDescendantOf(workspace)) and (PrimaryPart and PrimaryPart:IsDescendantOf(Character)) then
- if PrimaryPart.AssemblyAngularVelocity.Magnitude > 50 or PrimaryPart.AssemblyLinearVelocity.Magnitude > 100 then
- if Detected == false then
- game.StarterGui:SetCore("ChatMakeSystemMessage", {
- Text = "Fling Exploit detected, Player: " .. tostring(Player);
- Color = Color3.fromRGB(255, 200, 0);
- })
- end
- Detected = true
- for i,v in ipairs(Character:GetDescendants()) do
- if v:IsA("BasePart") then
- v.CanCollide = false
- v.AssemblyAngularVelocity = Vector3.new(0, 0, 0)
- v.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
- v.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0)
- end
- end
- PrimaryPart.CanCollide = false
- PrimaryPart.AssemblyAngularVelocity = Vector3.new(0, 0, 0)
- PrimaryPart.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
- PrimaryPart.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0)
- end
- end
- end)
- end
- _G.AntiFlingConfig = {
- -- this will remove your rotational velocity every frame
- disable_rotation = true;
- -- this slows you down if you're moving too fast, works well but can give you a low gravity effect
- limit_velocity = true;
- limit_velocity_sensitivity = 150; -- how fast you have to be moving before you get slowed down
- limit_velocity_slow = 0; -- the amount of velocity you keep; a lower number increases how much you slow down by
- -- stops you from ragdolling or falling over and losing control
- anti_ragdoll = true;
- -- completely freezes you if someone gets too close to you
- anchor = false;
- smart_anchor = true; -- only anchors if someone is considered flinging, this likely won't detect many flings
- anchor_dist = 30; -- how close someone has to be to trigger anchor
- -- teleport away if someone gets too close
- teleport = false;
- smart_teleport = true; -- only teleports if someone is considered flinging, this likely won't detect many flings
- teleport_dist = 30; -- how close someone has to be to teleport you
- }
- -- run _G.disable() to disable the script completely
- end
- end
- end)
- end
- local function isPartRotatingTooFast(part)
- if part and part:IsA("BasePart") then
- local lastRotation = part.Rotation
- wait(0.1) -- Wait a short time to get a second rotation value for comparison
- local currentRotation = part.Rotation
- local rotationChange = (currentRotation - lastRotation).Magnitude
- return rotationChange > rotationThreshold
- end
- return false
- end
- local function isPartInLocalPlayerCharacter(part)
- local localPlayer = game.Players.LocalPlayer
- if localPlayer and localPlayer.Character then
- return part:IsDescendantOf(localPlayer.Character)
- end
- return false
- end
- local function createSelectionBox(target)
- local outline = Instance.new("SelectionBox")
- outline.Name = "RedOutline"
- outline.Color3 = outlineColor.Color
- outline.Adornee = target
- outline.Parent = target
- return outline
- end
- ]]
- local G = {}
- local C = nil
- local function Collide(plr)
- if plr and plr.Character and plr ~= game.Players.LocalPlayer then
- for i,v in pairs (plr.Character:GetDescendants()) do
- if v:IsA"BasePart" and v.CanCollide == true then
- v.CanCollide = false
- v.AssemblyAngularVelocity = Vector3.new(0, 0, 0)
- v.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
- v.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0)
- end
- end
- end
- end
- local Players = Game:GetService"Players"
- local plr = Players.LocalPlayer
- local function Enable()
- for i,v in pairs (Players:GetPlayers()) do
- Collide(v)
- end
- end
- function G:Enable()
- C = game:GetService"RunService".RenderStepped: Connect (Enable)
- end
- function G:Disable()
- C: Disconnect ()
- for i,v in pairs(game.Players:GetPlayers()) do
- if v ~= plr then
- for h,b in pairs(v.Character:GetDescendants()) do
- if b:IsA"BasePart" and b.CanCollide == false then
- b.CanCollide = true
- end
- end
- end
- end
- end
- G:Enable()
- return G
- end
- end
- end)
- end
- -- // Event Listeners \\ --
- for i,v in ipairs(Services.Players:GetPlayers()) do if v ~= LocalPlayer then PlayerAdded(v) end end Services.Players.PlayerAdded:Connect(PlayerAdded) local LastPosition = nil Services.RunService.Heartbeat:Connect(function() pcall(function() local PrimaryPart = LocalPlayer.Character.PrimaryPart if PrimaryPart.AssemblyLinearVelocity.Magnitude > 250 or PrimaryPart.AssemblyAngularVelocity.Magnitude > 250 then PrimaryPart.AssemblyAngularVelocity = Vector3.new(0, 0, 0) PrimaryPart.AssemblyLinearVelocity = Vector3.new(0, 0, 0) PrimaryPart.CFrame = LastPosition game.StarterGui:SetCore("ChatMakeSystemMessage", { Text = "You were flung. Neutralizing velocity."; Color = Color3.fromRGB(255, 0, 0); }) elseif PrimaryPart.AssemblyLinearVelocity.Magnitude < 50 or PrimaryPart.AssemblyAngularVelocity.Magnitude > 50 then LastPosition = PrimaryPart.CFrame end end) end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement