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

Help with my admin ';spraykill' (Fencing)?

Asked by 3 years ago
local function fastwait()
    game:GetService("RunService").Heartbeat:wait()
    end
Admin.AddCommand("spraykill", function()
    Service = setmetatable(
{
    Get = function(Self, Serv)
        if Service[Serv] then return Service[Serv] end
        local S = game:GetService(Serv)
        if S then Service[Serv] = S end
        return S
    end;
}, {
    __index = function(Self, Index)
        local S = game:GetService(Index)
        if S then Service[Index] = S end
        return S
    end;
})

workspace['FallenPartsDestroyHeight'] = 0/1/0

local Create = function(Class,Parent)
    local Inst = Instance.new(Class); Inst['Parent'] = Parent; return Inst
end

print("Hi! - Synttax :D")

local LP = Service['Players'].LocalPlayer; local Char = LP['Character']

coroutine.wrap(function()
    settings()['Physics'].AllowSleep = false
    repeat
        Service['RunService'].RenderStepped:Wait()
        for I = 1,#Service['Players']:GetPlayers() do 
            local Player = Service['Players']:GetPlayers()[I]
            if Player ~= LP then 
                Player['MaximumSimulationRadius'] = .1
            end
        end
        LP['MaximumSimulationRadius'] = math.pow(1/0,1/0)
        sethiddenproperty(LP,'SimulationRadius',1/0)
    until nil
end)()

Char:BreakJoints(); LP.CharacterAdded:Wait(); Char = LP['Character']; wait(.2)

local Yield = Instance.new('BindableEvent')

local C = Char.ChildAdded:Connect(function(Obj)
    if rawequal(Obj['Name'],'Spray') then 
        Yield:Fire()
    end
end)

local Root, Humanoid = Char['HumanoidRootPart'], Char['Humanoid']

Root['CFrame'] = CFrame.new(-137.723511, 3.4000001, -57.1764297)

local Sprays = {};

for I = 1,Service['Players']['MaxPlayers']+1 do 
    firetouchinterest(Root,workspace['Handle'],0); firetouchinterest(Root,workspace['Handle'],1)
    Yield['Event']:Wait(); Service['RunService'].Heartbeat:Wait()
    table.insert(Sprays,Char['Spray']); Char['Spray'].Parent = workspace
end

Yield:Destroy(); C:Disconnect()

for K,V in next, Sprays do 
    Humanoid:EquipTool(V)
end

Root['Anchored'] = true

wait(.6); Humanoid:UnequipTools()

local Clone = Humanoid:Clone(); Clone['Parent'] = Char; Humanoid:Destroy()

for K,V in next, Sprays do 
    V['Parent'] = Char
end

Root['Anchored'] = false

local Forces, Ignore = {}, {}

for I = 1,#Sprays do 
    local Spray = Sprays[I]
    local Player = Service['Players']:GetPlayers()[I]
    if Player ~= LP then
        if Spray ~= nil and Player ~= nil then 
            local PChar = workspace:FindFirstChild(Player['Name'])
            if PChar ~= nil then 
                local PRoot, PHum = PChar:FindFirstChild('HumanoidRootPart') or PChar:FindFirstChild('Torso') or PChar:FindFirstChild('UpperTorso') or PChar:FindFirstChild('Head'), PChar:FindFirstChildOfClass('Humanoid')
                if PRoot ~= nil and PHum ~= nil then 
                    Spray['Grip'] = CFrame.new(0,0,I*1.5)
                    PRoot['CFrame'] = Spray['Handle'].CFrame
                    local xt=PChar
local Humanoid=xt.Humanoid
local xhp=xt.HumanoidRootPart
local tool=Spray
if looped==true then--If you have a valid tool, a tool with a part named Handle
tool.Parent = LocalPlayer.Character
fastwait()
tool.Parent = LocalPlayer.Backpack
LocalPlayer.Character:FindFirstChildOfClass("Humanoid"):Destroy()
local nh=Instance.new("Humanoid",LocalPlayer.Character)
fastwait()
tool.Parent = LocalPlayer.Character
while tool.Parent == LocalPlayer.Character do
tool.Handle.CFrame = xt.HumanoidRootPart.CFrame
fastwait()
end
--The kill function when attached:
LocalPlayer.Character=nil
nh.Health=0
Humanoid.Health=0
end
                end
            end
        end
    end
end
end, "Player")

Basically, what I want it to do is make it come to my tool and then set the player's health to 0 while sprays are anchored.

Answer this question