Hey guys, I got a script here that should equip you with a knife with an aiming laser that only the wearer can see. that knive you can throw at someone to kill him/destroy his shield-aura. The script is pretty big imo and i got no idea to convert all of that so it works again.

wait(0.6)
local player = game.Players.LocalPlayer
local character = player.Character
local pgui = player.PlayerGui
local torso = character.Torso
local gamemodel = Workspace.GameModel

local pmouse = player:GetMouse()
local camera = Workspace.CurrentCamera

local tool = script.Parent
local daggerspeed = 120
local spinspeed = 2
local maxdistance = 300
local fadetm = 1

local r_serv = game:GetService("RunService")

local fr = script.shadowdg:clone()
fr.Frame.Visible = true
local reach = fr.Frame.reach
reach.Text = ""


local beam = Instance.new("Part")
beam.Name = "DaggerBeam"
beam.formFactor = "Custom"
beam.Size = Vector3.new(0.2, 0.2, 0.2)
beam.Transparency = 0.2
beam.CanCollide = false
beam.Anchored = true
beam.TopSurface = 0
beam.BottomSurface = 0
beam.BrickColor = BrickColor.new("Really red")
local m = Instance.new("BlockMesh")
m.Scale = Vector3.new(1, 1, maxdistance / 0.2)
m.Offset = Vector3.new(0, 0, -maxdistance / 2)
m.Parent = beam

if _G.MOBILE_DEVICE then
	fr.Frame.reach.Visible = false
	fr.Frame.horizontal.Visible = false
	fr.Frame.Size = UDim2.new(0, 120, 0, 120)
	fr.Frame.Position = UDim2.new(1, -130, 0.5, -60)
	beam.Transparency = 1
end

function GenIgnore()
	local result = {}
	local ch = game.Players:GetPlayers()
	for i = 1, #ch do
		local char = ch[i].Character
		if char ~= nil then
			local sc = char:GetChildren()
			for a = 1, #sc do
				if sc[a]:IsA("Hat") or sc[a]:IsA("Tool") then
					result[#result + 1] = sc[a]
				end
			end
		end
	end
	return result
end

function randomsound()
	local rnd = {"146594648", "146594640", "146457047"}
	return "http://www.roblox.com/asset/?id=" .. rnd[math.random(1, #rnd)]
end

function RayCast(ps1, ps2, ignore)
	local ray = Ray.new(
	    ps1,
	    (ps2 - ps1).unit * (ps1 - ps2).magnitude
	)
	local nign = ignore
	nign[#nign + 1] = character
	return Workspace:FindPartOnRayWithIgnoreList(ray, nign) --hit, position
end

	local dg = Instance.new("Part")
	dg.formFactor = "Custom"
	dg.Size = Vector3.new(0.2, 0.2, 0.2)
	dg.BrickColor = BrickColor.new("Really black")
	dg.Transparency = 0.2
	dg.Anchored = true
	dg.CanCollide = false
	dg.TopSurface = 0
	dg.BottomSurface = 0
	local m = Instance.new("SpecialMesh")
	m.MeshId = "http://www.roblox.com/asset/?id=20719463"
	m.Scale = Vector3.new(1, 1.4, 1)
	m.Parent = dg
	local loop = Instance.new("Sound")
	loop.SoundId = "http://www.roblox.com/asset/?id=146470466"
	loop.Volume = 1
	loop.Looped = true
	loop.Parent = dg
	
	local dagger_rot = CFrame.Angles(math.rad(-90), math.rad(0), math.rad(-90))
	local spin = CFrame.Angles(0, 0, 0)

function DaggerScript(ps)
	local tps = torso.Position
	script.Parent = pgui
	tool.Parent = nil
	--DAGGER SCRIPT
	
	local ignores = GenIgnore()
	ignores[#ignores + 1] = gamemodel
	local tcf = CFrame.new(tps, ps)
	local travelled = 0
	dg.Parent = gamemodel
	dg.CFrame = tcf * dagger_rot * spin
	
	coroutine.resume(coroutine.create(function()
		wait(0.1)
		loop:play()
	end))
	
	while true do
		local st = tick()
		r_serv.RenderStepped:wait()
		local delta = (tick() - st)
		local dist = daggerspeed * delta
		local nps = tcf * CFrame.new(0, 0, -dist)
		spin = spin * CFrame.Angles(0, math.rad(-360 * delta * spinspeed), 0)
		travelled = travelled + dist
		
		--STUFF
		while true do
			local hit, pos = RayCast(tcf.p, nps.p, ignores)
			if hit ~= nil then
				local hum = hit.Parent:findFirstChild("Humanoid")
				if hum == nil then
					hum = hit.Parent.Parent:findFirstChild("Humanoid")
				end
				if hum ~= nil then
					ignores[#ignores + 1] = hum.Parent
					local sdf = hum.Parent:findFirstChild("ShieldDefence")
					if sdf ~= nil then
						sdf.TakeDamage.Value = true
					else
						hum.Parent:BreakJoints()
						local sndp = Instance.new("Part")
						sndp.formFactor = "Custom"
						sndp.Size = Vector3.new(0.2, 0.2, 0.2)
						sndp.Transparency = 1
						sndp.Anchored = true
						sndp.CanCollide = false
						sndp.CFrame = CFrame.new(pos)
						sndp.Parent = gamemodel
						local snd = Instance.new("Sound")
						snd.Volume = 1
						snd.SoundId = randomsound()
						snd.Parent = sndp
						coroutine.resume(coroutine.create(function()
							wait(0.1)
							snd:play()
							wait(1)
							sndp:remove()
						end))
					end
				else
					ignores[#ignores + 1] = hit
				end
			else
				break
			end
		end
		--STUFF
		
		tcf = nps
		dg.CFrame = tcf * dagger_rot * spin
		if travelled >= maxdistance then
			break
		end
	end
	
	local ld = 0
	while ld ~= 1 do
		local st = tick()
		r_serv.RenderStepped:wait()
		local delta = (tick() - st)
		ld = math.min(1, ld + delta / fadetm)
		local dist = daggerspeed * delta
		dg.Transparency = 0.2 + (0.8 * ld)
		spin = spin * CFrame.Angles(0, math.rad(-360 * delta * spinspeed), 0)
		tcf = tcf * CFrame.new(0, 0, -dist)
		dg.CFrame = tcf * dagger_rot * spin
	end
	
	dg:remove()
	
	--DAGGER SCRIPT
	print("The end")
	script.Parent = nil
end

local throwmode = false

local bounce = false
local eq = false
tool.Selected:connect(function(mouse)
	eq = true
	if bounce then return end
	fr.Parent = pgui
	beam.Parent = camera
	mouse.Button1Down:connect(function()
		fr.Parent = nil
		beam.Parent = nil
		if bounce then return end
		bounce = true
		if not throwmode then
			DaggerScript(mouse.Hit.p)
		else
			local ps = mouse.Hit.p
			DaggerScript(Vector3.new(ps.x, torso.Position.y, ps.z))
		end
	end)
	mouse.KeyDown:connect(function(key)
		if string.lower(key) == "q" then
			throwmode = not throwmode
		end
	end)
end)

tool.Deselected:connect(function()
	eq = false
	fr.Parent = nil
	beam.Parent = nil
end)

while not bounce do
	r_serv.RenderStepped:wait()
	if eq then
		if not throwmode then
			beam.CFrame = CFrame.new(torso.Position, pmouse.Hit.p)
			if (torso.Position - pmouse.Hit.p).magnitude <= maxdistance then
				reach.Text = "WILL REACH TARGET"
				reach.TextColor3 = Color3.new(0, 1, 0)
			else
				reach.Text = "WON'T REACH TARGET"
				reach.TextColor3 = Color3.new(1, 0, 0)
			end
		else
			local ps = pmouse.Hit.p
			beam.CFrame = CFrame.new(torso.Position, Vector3.new(ps.x, torso.Position.y, ps.z))
			if (torso.Position - Vector3.new(ps.x, torso.Position.y, ps.z)).magnitude <= maxdistance then
				reach.Text = "WILL REACH TARGET"
				reach.TextColor3 = Color3.new(0, 1, 0)
			else
				reach.Text = "WON'T REACH TARGET"
				reach.TextColor3 = Color3.new(1, 0, 0)
			end
		end
	end
end
beam.Parent = nil

Sry for the script being so damn long, but i really dont know which parts to edit and which not. :/

3 comments

0

If you're going to make a game, you must know fe inside out: https://www.youtube.com/watch?v=4Dc_bri9mjs&t=1s

0

^^^

0

^^^