Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make this detect if a part doesn't contain humanoid?

Asked by 9 years ago

I am aware that this is a VERY inefficient script, but that's not why its here

local tool = script.Parent local player = game:GetService("Players").LocalPlayer local X = 0 local Debounce = false local Damage = 0 local Ammount = 0 local Conflict = false tool.Equipped:connect(function(mouse) print("Tool equipped!")

01mouse.Button1Down:connect(function()
02    print("Mouse pressed!")
03    if Debounce == true then
04        return
05    end
06    Debounce = true
07    local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300)
08    local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
09 
10    local Charge = Instance.new("Part", workspace)
11    Charge.BrickColor = BrickColor.new("Toothpaste")
12    Charge.Anchored = true
13    Charge.Material = "Neon"
14    Charge.Transparency = 0.5
15    Charge.Locked = true
View all 88 lines...

end)

In short. The laser works if it hits a part containing Humanoid, but it doesn't work if it hits nothing or a part doesn't contain Humanoid

1
Please fix the formatting and read the instructions on how NOT to post a ques such as um... trying to post a huge script which would take us too long to pull apart, please do your best to locate the nearest 10-30 lines of code to the error dragonkeeper467 453 — 9y
0
https://scriptinghelpers.org/blog/posting-good-questions-and-answers-on-scripting-helpers <- here ya go! obey or leave cause we shouldn't have to keep repeating ourselves dragonkeeper467 453 — 9y

Answer this question