So this is the main part of the flamethrower. the "mouse.Button1Down" is another function that makes fire enabled and clones the damage script. How can I make it so when you kill someone, it gets added to your KOs? Here's the main gun script and the damage script:
I added creator tags to them, but it isn't working! (The equipped script is a local script)
plr = game.Players.LocalPlayer
creator = Instance.new("ObjectValue")
creator.Name = "creator"
creator.Value = plr
Tool.Equipped:connect(function(mouse)
local Humanoid = script.Parent.Parent.Humanoid
Humanoid.WalkSpeed = 10
mouse.Icon="rbxasset://textures\\GunCursor.png"
animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=331030667"
animTrack = Humanoid:LoadAnimation(animation)
animTrack:Play()
mouse.Button1Down:connect(function() MouseDown(mouse) end)
mouse.Button1Up:connect(function() MouseUp(mouse) end)
grip = Instance.new("Weld",script.Parent.Parent.Torso)
grip.Part0 = script.Parent.Parent.Torso
grip.Part1 = script.Parent.Handle
grip.C0 = CFrame.new(0,0,-2)*CFrame.Angles(math.rad(10),math.rad(20),0)
grip.Name = "Grip"
while wait() do
if script.Parent.Parent:FindFirstChild("Right Arm")then
for _,v in pairs(script.Parent.Parent["Right Arm"]:GetChildren())do
if v.Name == "RightGrip" then
game.Debris:AddItem(v,0)
break
end
end
end
end
end)
Tool.Unequipped:connect(function()
fire1.Enabled = false
fire2.Enabled = false
fire3.Enabled = false
animTrack:Stop()
game.Debris:AddItem(animation,0)
game.Debris:AddItem(grip,0)
script.Parent.Parent.Parent.Character.Humanoid.WalkSpeed = 16
end)
^^^^^^^^^ These are two different scripts vvvvvvvvv
brick = script.Parent
debounce = false
-- Variables
brick.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and not debounce then
debounce = true
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local hum = hit.Parent.Humanoid
if not plr and hum.Health > 0 and hit.Parent.Torso.Anchored == false and hit.Parent.Name ~= "Vault" and hit.Parent.Name ~= "Soldier" and hit.Parent.Name ~= "" and hit.Parent.Name ~= " " and hit.Parent.Name ~= "Governor" and hit.Parent.Name ~= "Emperor" then
local ice = Instance.new("Part")
hit.Parent.Torso.Anchored = true
ice.Anchored = true
ice.Transparency = 0.3
ice.BrickColor = BrickColor.new("Teal")
ice.BottomSurface = "Smooth"
ice.TopSurface = "Smooth"
ice.Size = Vector3.new(5,8,5)
ice.CFrame = CFrame.new(hit.Parent.Torso.CFrame.p)
ice.Parent = hit
local filt1 = script.Parent.filter:Clone()
filt1.Parent = ice
filt1.Disabled = false
local tag=creator:clone()
tag.Parent=Hum
hit.Parent.Humanoid:TakeDamage(50)
elseif plr and hum.Health > 0 and hit.Parent.Torso.Anchored == false and plr.TeamColor ~= BrickColor.new("Bright blue") then
local ice = Instance.new("Part")
ice.Size = Vector3.new(5,8,5)
script.Parent.Parent.Torso.Anchored = true
ice.Anchored = true
ice.Transparency = 0.3
ice.BrickColor = BrickColor.new("Teal")
ice.BottomSurface = "Smooth"
ice.TopSurface = "Smooth"
ice.CFrame = CFrame.new(hit.Parent.Torso.CFrame.p)
ice.Parent = hit
local filt2 = script.Parent.filter:Clone()
filt2.Parent = ice
filt2.Disabled = false
local tag=creator:clone()
tag.Parent=Hum
hit.Parent.Humanoid:TakeDamage(50)
end
end
wait(.1)
debounce = false
end)
