Trying to make a functioning killfeed, but the killfeed textlabel is only cloned if the damage is 100 or greater.
damage = math.random(15,45)
if enabled == true then
local ammo = script.Parent.Ammo.Value
if ammo > 0 then
script.Parent.Handle.Barrel.Smoke.FX.Enabled = true
enabled = false
local c = Instance.new("Animation")
c.AnimationId = fire
FIRE = player.Character.Humanoid:LoadAnimation(c)
FIRE:Play()
wait()
script.Parent.Handle.Fire:Play()
script.Parent.Ammo.Value -= 1
script.Parent.Handle.Barrel.Barrel.FlashFX.Enabled = true
script.Parent.Handle.Barrel.Beam.Enabled = true
script.Parent.Handle.Barrel.Beam.CurveSize0 = math.random(-20,20)/5
script.Parent.Handle.Barrel.Beam.CurveSize1 = math.random(-20,20)/5
--[[local mouse = player:GetMouse()
local target = mouse.Target]]
-- local Distance = (target.Position - player.Character.HumanoidRootPart.Position).Magnitude
--if Distance < range then
if string.find(target.Name,"Torso") or string.find(target.Name,"Arm") or string.find(target.Name,"Leg") or string.find(target.Name,"Head") then
if target.Parent:FindFirstChild("Humanoid") then
shotplayer = game.Players:GetPlayerFromCharacter(target.Parent)
if target.Name == "Head" then
local int = (math.random(20,30)/10)
target.Parent.Humanoid.Health -= damage*int
local indicator = game.ReplicatedStorage.Damage:Clone()
local part = Instance.new("Part")
part.Parent = workspace
part.Name = "Indicator"
part.Transparency = 1
part.CanCollide = 1
part.Size = Vector3.new(0,0,0)
part.Position = target.Position
part.Anchored = true
part.CanCollide = false
part.CanQuery = false
part.CanTouch = false
indicator.Parent = part
indicator.TextLabel.Text = math.floor((damage*int)*10)/10
indicator.TextLabel.FontFace.Weight = Enum.FontWeight.Heavy
else
target.Parent.Humanoid.Health -= damage
local indicator = game.ReplicatedStorage.Damage:Clone()
local part = Instance.new("Part")
part.Parent = workspace
part.Name = "Indicator"
part.Transparency = 1
part.CanCollide = 1
part.Size = Vector3.new(0,0,0)
part.Position = target.Position
part.Anchored = true
part.CanCollide = false
part.CanQuery = false
part.CanTouch = false
indicator.Parent = part
indicator.TextLabel.Text = damage
indicator.TextLabel.FontFace.Weight = Enum.FontWeight.Regular
-- end
end
game.ReplicatedStorage.Hit:FireClient(player)
-- {{ KILLFEED }} --
if target.Parent:FindFirstChild("Humanoid") and target.Parent:FindFirstChild("Tag") then
target.Parent:FindFirstChild("Tag"):Destroy()
if target.Parent.Humanoid.Health <= 0 then
for i,player in pairs(game.Players:GetChildren()) do
local ui = game.ReplicatedStorage.Killfeeditem:Clone()
ui.Parent = player.PlayerGui.ScreenGui.KillFeed
ui.player.Text = player.Name
ui.victim.Text = target.Parent.Name
--ui.victim.Text = shotplayer.DisplayName
script.Image:Clone().Parent = ui
end
end
end
end
end
wait(.075)
script.Parent.Handle.Barrel.Beam.Enabled = false
script.Parent.Handle.Barrel.Barrel.FlashFX.Enabled = false
wait(.3)
enabled = true
wait(math.random(1,2))
script.Parent.Handle.Barrel.Smoke.FX.Enabled = false
--{{ RELOAD }}
elseif ammo <= 0 then
if script.Parent.Ammo.Value < script.Parent.Max.Value and reloading == false then
if player[script.Parent.AmmoString.Value].Value > 0 then
reloading = true
local d = Instance.new("Animation")
d.AnimationId = reload
RELOAD = player.Character.Humanoid:LoadAnimation(d)
RELOAD:Play()
script.Parent.Handle.Click:Play()
wait(.425)
script.Parent.Handle.Click:Play()
wait(.425)
script.Parent.Handle.Click:Play()
wait(.425)
script.Parent.Handle.Click:Play()
wait(.425)
script.Parent.Handle.Click:Play()
wait(.425)
script.Parent.Handle.Click:Play()
wait(.35)
script.Parent.Handle.Spin:Play()
if player[script.Parent.AmmoString.Value].Value >= script.Parent.Max.Value then
player[script.Parent.AmmoString.Value].Value -= (script.Parent.Max.Value - script.Parent.Ammo.Value)
script.Parent.Ammo.Value = script.Parent.Max.Value
elseif player[script.Parent.AmmoString.Value].Value < script.Parent.Max.Value then
script.Parent.Ammo.Value = player[script.Parent.AmmoString.Value].Value
player[script.Parent.AmmoString.Value].Value = 0
end
reloading = false
--{{ }}
end
end
end
end
end)
i assume the error is within if string.find(target.Name,"Torso") or string.find(target.Name,"Arm") or string.find(target.Name,"Leg") or string.find(target.Name,"Head") then and script.Image:Clone().Parent = ui