of     1   

KingJacko
#146543581Sunday, September 21, 2014 11:34 PM GMT

ill give you the two lines of code that i you need. RayIgnore = {script.Parent,script.Parent.Parent}--tool,character hit,position = Game.Workspace:FindPartOnRayWithIgnoreList(ray,Settings.RayIgnore) Im still hitting the gun handle and the character. HOW?!?!?
BruceAB12
#146543768Sunday, September 21, 2014 11:37 PM GMT

http://wiki.roblox.com/index.php?title=FindPartOnRay_(Method) Read the red warning box. Keep it simple.
FreeScriptMaker
#146543829Sunday, September 21, 2014 11:37 PM GMT

The first thing I notice here is that there is no reason to ignore both the tool and the character because if you just ignore the character then it will also ignore all its descendants and the tool is one of them. The second thing is you declare the table as RayIgnore, but when you call the FindPartOnRayWithIgnoreList method you use another table named Settings.RayIgnore So this should work: hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, script.Parent.Parent)
KingJacko
#146543963Sunday, September 21, 2014 11:39 PM GMT

"The first thing I notice here is that there is no reason to ignore both the tool and the character because if you just ignore the character then it will also ignore all its descendants and the tool is one of them." Sorry its late by me and i dont think. Thanks for putting up with my stupity.
KingJacko
#146544086Sunday, September 21, 2014 11:40 PM GMT

its unable to cast value to objects.
BruceAB12
#146544182Sunday, September 21, 2014 11:41 PM GMT

Ignore my post lol. Keep it simple.
FreeScriptMaker
#146544246Sunday, September 21, 2014 11:42 PM GMT

Can you post the full script?
KingJacko
#146544278Sunday, September 21, 2014 11:42 PM GMT

sure but its 60 lines.
KingJacko
#146544318Sunday, September 21, 2014 11:43 PM GMT

Tool = script.Parent Handle = Tool.Handle Player = Game.Players.LocalPlayer Settings = { --GUN-- Damage = {10,30}; Range = 100; MaxAmmo = 10; ReloadTime = 2; --OTHER-- HumanoidName = "Humanoid"; TeamKill = false; RayIgnore = {script.Parent,script.Parent.Parent}--tool,character } function Fire() Character = Player.Character Humanoid = Character.Humanoid TargetPos = Humanoid.TargetPoint Direction = (TargetPos - Character.Head.Position).unit ray = Ray.new(Character.Head.Position,Direction*Settings.Range) hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, script.Parent.Parent) distance = ((position - Tool.Handle.Position).magnitude) lazer = Instance.new("Part",Game.Workspace) lazer.Anchored = true lazer.BrickColor = Player.TeamColor lazer.Transparency = 0.5 lazer.BottomSurface = "Smooth" lazer.TopSurface = "Smooth" lazer.CanCollide = false lazer.FormFactor = "Custom" lazer.Size = Vector3.new(0.2,0.2,distance) lazer.CFrame = CFrame.new(position,Tool.Handle.Position) * CFrame.new(0,0,-distance/2) s2 = script.RemoveLazer:Clone() s2.Parent = lazer s2.Disabled = false if hit then print(hit.Parent.Name) if hit.Parent:findFirstChild(Settings.HumanoidName) then eHumanoid = hit.Parent[Settings.HumanoidName] if Settings.TeamKill == true then eHumanoid.Health = eHumanoid.Health - math.random(Settings.Damage[1],Settings.Damage[2]) elseif Settings.TeamKill == false then ePlayer = Game.Players:GetPlayerFromCharacter(eHumanoid.Parent) if ePlayer.TeamColor == Player.TeamColor then print("Same Team!") elseif ePlayer.TeamColor ~= Player.TeamColor then eHumanoid.Health = eHumanoid.Health - math.random(Settings.Damage[1],Settings.Damage[2]) end end end elseif hit == nil then print("'hit' doesnt exist") end end function Activated() Fire() end Tool.Activated:connect(Activated)
Bebee2
#146544434Sunday, September 21, 2014 11:44 PM GMT

ill give you the two lines of code that i you need. hit,position = Game.Workspace:FindPartOnRay(ray,script.Parent.Parent) Or . RayIgnore = {script.Parent.Parent}--tool,character hit,position = Game.Workspace:FindPartOnRayWithIgnoreList(ray,RayIgnore)
KingJacko
#146545242Sunday, September 21, 2014 11:55 PM GMT

umg i already tryed that...
KingJacko
#146545273Sunday, September 21, 2014 11:56 PM GMT

tried*
Bebee2
#146545371Sunday, September 21, 2014 11:57 PM GMT

"Settings.RayIgnore" RayIgnore = {... Not sure if custom environment or...
KingJacko
#146545777Monday, September 22, 2014 12:02 AM GMT

i have Settings = { } then stuff. Please only respond if you are going to help. I would be getting a totally different error.
L0cky2013
#146546117Monday, September 22, 2014 12:08 AM GMT

RayIgnore = {script.Parent,script.Parent.Parent, Workspace.CurrentCamera}
Bebee2
#146546754Monday, September 22, 2014 12:17 AM GMT

Tried hit,position = Game.Workspace:FindPartOnRayWithIgnoreList(ray,{script.Parent.Parent}) from a direct copy and paste and removed 3 lines because I don't have RemoveLazer within my tool and it worked perfectly fine. > Flamed before testing what I posted
KingJacko
#146568813Monday, September 22, 2014 10:20 AM GMT

im still hitting my character.
KingJacko
#146584392Monday, September 22, 2014 7:43 PM GMT

bump D:
vlekje513
#146586392Monday, September 22, 2014 8:21 PM GMT

Tool = script.Parent Handle = Tool.Handle Player = Game.Players.LocalPlayer Settings = { --GUN-- Damage = {10,30}; Range = 100; MaxAmmo = 10; ReloadTime = 2; --OTHER-- HumanoidName = "Humanoid"; TeamKill = false; RayIgnore = {script.Parent,script.Parent.Parent} function Fire() Character = Player.Character Humanoid = Character.Humanoid TargetPos = Humanoid.TargetPoint Direction = (TargetPos - Character.Head.Position).unit ray = Ray.new(Character.Head.Position,Direction*Settings.Range) hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, RayIgnore) distance = ((position - Tool.Handle.Position).magnitude) lazer = Instance.new("Part",Game.Workspace) lazer.Anchored = true lazer.BrickColor = Player.TeamColor lazer.Transparency = 0.5 lazer.BottomSurface = "Smooth" lazer.TopSurface = "Smooth" lazer.CanCollide = false lazer.FormFactor = "Custom" lazer.Size = Vector3.new(0.2,0.2,distance) lazer.CFrame = CFrame.new(position,Tool.Handle.Position) * CFrame.new(0,0,-distance/2) s2 = script.RemoveLazer:Clone() s2.Parent = lazer s2.Disabled = false if hit then print(hit.Parent.Name) if hit.Parent:findFirstChild(Settings.HumanoidName) then eHumanoid = hit.Parent[Settings.HumanoidName] if Settings.TeamKill == true then eHumanoid.Health = eHumanoid.Health - math.random(Settings.Damage[1],Settings.Damage[2]) elseif Settings.TeamKill == false then ePlayer = Game.Players:GetPlayerFromCharacter(eHumanoid.Parent) if ePlayer.TeamColor == Player.TeamColor then print("Same Team!") elseif ePlayer.TeamColor ~= Player.TeamColor then eHumanoid.Health = eHumanoid.Health - math.random(Settings.Damage[1],Settings.Damage[2]) end end end elseif hit == nil then print("'hit' doesnt exist") end end function Activated() Fire() end Tool.Activated:connect(Activated)
vlekje513
#146586510Monday, September 22, 2014 8:23 PM GMT

Handle = Tool.Handle Player = Game.Players.LocalPlayer Settings = { --GUN-- Damage = {10,30}; Range = 100; MaxAmmo = 10; ReloadTime = 2; --OTHER-- HumanoidName = "Humanoid"; TeamKill = false; RayIgnore = {script.Parent,script.Parent.Parent} function Fire() Character = Player.Character Humanoid = Character.Humanoid TargetPos = Humanoid.TargetPoint Direction = (TargetPos - Character.Head.Position).unit ray = Ray.new(Character.Head.Position,Direction*Settings.Range) hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, Settings.RayIgnore) distance = ((position - Tool.Handle.Position).magnitude) lazer = Instance.new("Part",Game.Workspace) lazer.Anchored = true lazer.BrickColor = Player.TeamColor lazer.Transparency = 0.5 lazer.BottomSurface = "Smooth" lazer.TopSurface = "Smooth" lazer.CanCollide = false lazer.FormFactor = "Custom" lazer.Size = Vector3.new(0.2,0.2,distance) lazer.CFrame = CFrame.new(position,Tool.Handle.Position) * CFrame.new(0,0,-distance/2) s2 = script.RemoveLazer:Clone() s2.Parent = lazer s2.Disabled = false if hit then print(hit.Parent.Name) if hit.Parent:findFirstChild(Settings.HumanoidName) then eHumanoid = hit.Parent[Settings.HumanoidName] if Settings.TeamKill == true then eHumanoid.Health = eHumanoid.Health - math.random(Settings.Damage[1],Settings.Damage[2]) elseif Settings.TeamKill == false then ePlayer = Game.Players:GetPlayerFromCharacter(eHumanoid.Parent) if ePlayer.TeamColor == Player.TeamColor then print("Same Team!") elseif ePlayer.TeamColor ~= Player.TeamColor then eHumanoid.Health = eHumanoid.Health - math.random(Settings.Damage[1],Settings.Damage[2]) end end end elseif hit == nil then print("'hit' doesnt exist") end end function Activated() Fire() end Tool.Activated:connect(Activated)
vlekje513
#146586573Monday, September 22, 2014 8:24 PM GMT

Handle = Tool.Handle Player = Game.Players.LocalPlayer Settings = { --GUN-- Damage = {10,30}; Range = 100; MaxAmmo = 10; ReloadTime = 2; --OTHER-- HumanoidName = "Humanoid"; TeamKill = false; RayIgnore = {script.Parent,script.Parent.Parent} function Fire() Character = Player.Character Humanoid = Character.Humanoid TargetPos = Humanoid.TargetPoint Direction = (TargetPos - Character.Head.Position).unit ray = Ray.new(Character.Head.Position,Direction*Settings.Range) hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, Settings.RayIgnore) distance = ((position - Tool.Handle.Position).magnitude) lazer = Instance.new("Part",Game.Workspace) lazer.Anchored = true lazer.BrickColor = Player.TeamColor lazer.Transparency = 0.5 lazer.BottomSurface = "Smooth" lazer.TopSurface = "Smooth" lazer.CanCollide = false lazer.FormFactor = "Custom" lazer.Size = Vector3.new(0.2,0.2,distance) lazer.CFrame = CFrame.new(position,Tool.Handle.Position) * CFrame.new(0,0,-distance/2) s2 = script.RemoveLazer:Clone() s2.Parent = lazer s2.Disabled = false print(hit) print(position) if hit then print(hit.Parent.Name) if hit.Parent:findFirstChild(Settings.HumanoidName) then eHumanoid = hit.Parent[Settings.HumanoidName] if Settings.TeamKill == true then eHumanoid.Health = eHumanoid.Health - math.random(Settings.Damage[1],Settings.Damage[2]) elseif Settings.TeamKill == false then ePlayer = Game.Players:GetPlayerFromCharacter(eHumanoid.Parent) if ePlayer.TeamColor == Player.TeamColor then print("Same Team!") elseif ePlayer.TeamColor ~= Player.TeamColor then eHumanoid.Health = eHumanoid.Health - math.random(Settings.Damage[1],Settings.Damage[2]) end end end elseif hit == nil then print("'hit' doesnt exist") end end function Activated() Fire() end Tool.Activated:connect(Activated)
vlekje513
#146586659Monday, September 22, 2014 8:25 PM GMT

Handle = Tool.Handle Player = Game.Players.LocalPlayer Settings = { --GUN-- Damage = {10,30}; Range = 100; MaxAmmo = 10; ReloadTime = 2; --OTHER-- HumanoidName = "Humanoid"; TeamKill = false; RayIgnore = {Player.Character} function Fire() Character = Player.Character Humanoid = Character.Humanoid TargetPos = Humanoid.TargetPoint Direction = (TargetPos - Character.Head.Position).unit ray = Ray.new(Character.Head.Position,Direction*Settings.Range) hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, Settings.RayIgnore) distance = ((position - Tool.Handle.Position).magnitude) lazer = Instance.new("Part",Game.Workspace) lazer.Anchored = true lazer.BrickColor = Player.TeamColor lazer.Transparency = 0.5 lazer.BottomSurface = "Smooth" lazer.TopSurface = "Smooth" lazer.CanCollide = false lazer.FormFactor = "Custom" lazer.Size = Vector3.new(0.2,0.2,distance) lazer.CFrame = CFrame.new(position,Tool.Handle.Position) * CFrame.new(0,0,-distance/2) s2 = script.RemoveLazer:Clone() s2.Parent = lazer s2.Disabled = false print(hit) print(position) if hit then print(hit.Parent.Name) if hit.Parent:findFirstChild(Settings.HumanoidName) then eHumanoid = hit.Parent[Settings.HumanoidName] if Settings.TeamKill == true then eHumanoid.Health = eHumanoid.Health - math.random(Settings.Damage[1],Settings.Damage[2]) elseif Settings.TeamKill == false then ePlayer = Game.Players:GetPlayerFromCharacter(eHumanoid.Parent) if ePlayer.TeamColor == Player.TeamColor then print("Same Team!") elseif ePlayer.TeamColor ~= Player.TeamColor then eHumanoid.Health = eHumanoid.Health - math.random(Settings.Damage[1],Settings.Damage[2]) end end end elseif hit == nil then print("'hit' doesnt exist") end end function Activated() Fire() end Tool.Activated:connect(Activated)

    of     1