0% found this document useful (0 votes)
39 views3 pages

Message

Uploaded by

fmatyia6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views3 pages

Message

Uploaded by

fmatyia6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

local function createForceField(plr, size, hitForce)

local size = tonumber(size) or 5


local hitForce = tonumber(hitForce) or 250

-- Limit the size and hit force


size = math.min(size, 70)
hitForce = math.min(hitForce, 3000)

local function GetTouchingParts(part)


local connection = part.Touched:Connect(function() end)
local results = part:GetTouchingParts()
connection:Disconnect()
return results
end

local TS = game:GetService("TweenService")

-- Get player character


local mChar = plr.Character
if not mChar or not mChar:FindFirstChild("HumanoidRootPart") or
mChar.Humanoid.Health <= 0 then
return
end

-- Clean up existing forcefields


for _, obj in pairs(mChar:GetChildren()) do
if obj.Name == "ForceField2Part" or obj.Name == "ForceField2" then
obj:Destroy()
end
end

-- Create main forcefield part


local part = Instance.new("Part")
part.Name = "ForceField2Part"
part.Massless = true
part.CanCollide = false
part.Locked = true
part.Size = Vector3.new(size, size, size)
part.Shape = Enum.PartType.Ball
part.Material = Enum.Material.ForceField
part.Color = Color3.fromRGB(255, 176, 65)
part.Transparency = 0

local mesh = Instance.new("SpecialMesh", part)


mesh.MeshType = Enum.MeshType.FileMesh
mesh.Scale = Vector3.new(size / 2, size / 2, size / 2)
mesh.MeshId = "rbxassetid://2909677195"
mesh.TextureId = "rbxassetid://2909669397"

part.Parent = mChar
part.CFrame = mChar.HumanoidRootPart.CFrame

local w = Instance.new("WeldConstraint")
w.Part0 = mChar.HumanoidRootPart
w.Part1 = part
w.Parent = part

part:SetNetworkOwner(plr)
-- Create ForceField
local ff = Instance.new("ForceField")
ff.Name = "ForceField2"
ff.Visible = false
ff.Parent = mChar

-- Create sound effects


local humSound = Instance.new("Sound")
humSound.SoundId = "http://www.roblox.com/asset/?id=317843109"
humSound.Volume = 0.65
humSound.Looped = true
humSound.EmitterSize = 5
humSound.Parent = part
humSound:Play()

-- Track hits
local hitDBs = {}

local function disconnect()


humSound:Destroy()
part:Destroy()
end

local function applyForce(hitPart)


local hitChar = hitPart.Parent
local hitHum = hitChar:FindFirstChildOfClass("Humanoid")

-- Check for "Icelogist"


if hitChar.Name == "Icelogist" then
disconnect()
return
end

if hitChar ~= mChar and hitHum and hitHum.Health > 0 then


if hitDBs[hitChar] then return end

hitDBs[hitChar] = true
task.delay(1.5, function() hitDBs[hitChar] = nil end)

-- Fling with ragdoll effect


local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(1e6, 1e6, 1e6)
bodyVelocity.Velocity = (hitChar.HumanoidRootPart.Position -
part.Position).Unit * hitForce + Vector3.new(0, hitForce / 2, 0)
bodyVelocity.Parent = hitChar.HumanoidRootPart

-- Cleanup fling effect


game.Debris:AddItem(bodyVelocity, 0.5)

-- Visuals
local zapSound = Instance.new("Sound")
zapSound.SoundId = "http://www.roblox.com/asset/?id=318154687"
zapSound.Volume = 1.5
zapSound.Parent = hitChar.HumanoidRootPart
zapSound:Play()
game.Debris:AddItem(zapSound, 2)

hitHum:TakeDamage(100)
end
end

-- Check collisions
local loop = true
task.spawn(function()
while loop do
task.wait(0.1)
local touchings = GetTouchingParts(part)
for _, v in ipairs(touchings) do
if v.Parent and v.Parent:FindFirstChild("Humanoid") and not
hitDBs[v.Parent] then
applyForce(v)
end
end
end
end)

-- Cleanup on character removal or death


mChar.AncestryChanged:Connect(function(_, parent)
if not parent then disconnect() end
end)

mChar.Humanoid.Died:Connect(disconnect)
end

local player = game.Players:FindFirstChild("B44QL1")


if player then
createForceField(player, 9, 500)
end

You might also like