Full Script
local ListOfNames = require(game.ReplicatedStorage.Modules.ListOfNamesM1)
local Tool = script.Parent
local Remote = Tool:WaitForChild("Remote")
local Handle = Tool:WaitForChild("Handle")
local Conf = script.Parent.Conf
local BrokenEggMesh = "http://www.roblox.com/asset/?id=1529081"
local FriendlyFire = false
local CanThrow = true
local AttackPower = 1
local AttackDamage = Conf.Damage.Value
local HeadShot = Conf.Headshot.Value
local AtackRechargeTime = 2
local AttackRecharge = 1/AtackRechargeTime
local AttackSpeed = 256
local Equipped = false
local Heartbeat = game:GetService("RunService").Heartbeat
local Knives = {}
local function getPlayer()
local char = Tool.Parent
return game:GetService("Players"):GetPlayerFromCharacter(char)
end
local function contains(t, v)
for _, val in pairs(t) do
if val == v then
return true
end
end
return false
end
local function tagHuman(human)
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "creator"
tag.Parent = human
game:GetService("Debris"):AddItem(tag)
end
local function sameTeam(otherHuman)
local player = getPlayer()
local otherPlayer = game:GetService("Players"):GetPlayerFromCharacter(otherHuman.Parent)
if player and otherPlayer then
return player.TeamColor == otherPlayer.TeamColor
end
return false
end
local function checkTeams(otherHuman)
return not (sameTeam(otherHuman) and not FriendlyFire)
end
local function Morph(player, model)
local Char = model:Clone()
local Pos = player.Character:GetPrimaryPartCFrame()
local Schar = game.StarterPlayer:FindFirstChild("StarterCharacter")
game:GetService("StarterPlayer")
player.Character:Destroy()
player.Character = Char
Char.Parent = workspace
Char:SetPrimaryPartCFrame(Pos)
end
local function getKnife()
local knife = Handle:clone()
knife.Trail.Enabled = true
knife.Transparency = 0
knife.Hit.Pitch = math.random(90, 110)/100
local lift = Instance.new("BodyForce")
lift.force = Vector3.new(0, 196.2, 0) * knife:GetMass() * 0.8
lift.Parent = knife
local proj = Tool.Projectile:Clone()
proj.Disabled = false
proj.Parent = knife
return knife
end
local TableOfPlayers = {
"Bacon",
"Jary",
"John",
}
local function equippedLoop()
while Equipped do
local dt = Heartbeat:wait()
if AttackPower < 1 then
AttackPower = AttackPower + dt * AttackRecharge
if AttackPower > 1 then
AttackPower = 1
end
end
Handle.Transparency = 1 - AttackPower
end
end
local function onLeftDown(mousePos)
local knife = getKnife()
knife.CFrame = CFrame.new(Handle.Position, mousePos)
knife.Velocity = knife.CFrame.lookVector * AttackSpeed * AttackPower
local damage = AttackDamage * AttackPower
local touched
touched = knife.Touched:connect(function(hit)
if hit:IsDescendantOf(Tool.Parent) then return end
if contains(Knives, hit) then return end
if hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
knife.Trail.Enabled = false
local human = hit.Parent.Humanoid
local player = game:GetService('Players'):GetPlayerFromCharacter(hit.Parent)
local Choice = math.random(1,#TableOfPlayers)
local modelC = TableOfPlayers[Choice]
local model = game.ReplicatedStorage.Morphs:FindFirstChild(modelC)
print(modelC)
if hit.Parent.Name ~= model then
Morph(player, model)
knife.Transparency = 1
elseif hit.Parent.Name == model then
tagHuman(human)
human:TakeDamage(damage)
knife.Hit:Play()
knife.Transparency = 1
end
end
knife.Projectile:Destroy()
local w = Instance.new("Weld")
w.Part0 = hit
w.Part1 = knife
w.C0 = hit.CFrame:toObjectSpace(knife.CFrame)
w.Parent = w.Part0
touched:disconnect()
end)
table.insert(Knives, knife)
knife.Parent = workspace
game:GetService("Debris"):AddItem(knife, 3.5)
delay(1, function()
knife.Transparency = 1
end)
Remote:FireClient(getPlayer(), "PlayAnimation", "Throw")
Handle.Throw.Pitch = 0.8 + 0.4 * AttackPower
Handle.Throw:Play()
AttackPower = 0
end
local function onRemote(player, func, ...)
if player ~= getPlayer() then return end
if func == "LeftDown" and CanThrow == true then
CanThrow = false
onLeftDown(...)
wait(1)
CanThrow = true
end
end
local function onEquip()
Equipped = true
equippedLoop()
end
local function onUnequip()
Equipped = false
end
Remote.OnServerEvent:connect(onRemote)
Tool.Equipped:connect(onEquip)
Tool.Unequipped:connect(onUnequip)
2 comments
I’m lost, you never even require the list, or select something??
I only pasted some parts of the script