recently i made a tool have a gun inside of it when i made script which i saw on one of alvin blox videos it didnt work i dont know why i did every thing in the video but it didnt work
Script
–script.Parent.Fire.OnServerEvent:Connect(function(player,mousePos)
local p = RaycastParams.new()
p.FilterDescendantsInstances = (player.Character)
p.FilterType = Enum.RaycastFilterType.Blacklist
local re = workspace:Raycast(script.Parent.Pistol.Model.Aim_Sight.Pat.Position,(mousePos - script.Parent.Handle.Position)*400,p)
if re then
local hi = re.Instance
local mo = hi:FindFirstAncestoOfClass("Model")
if mo then
if mo:FinFirstChild("Humanoid") then
mo.Humanoi.Health -= 30
end
end
end
this is the script
script.Parent.Fire.OnServerEvent:Connect(function(player,mousePos)
local p = RaycastParams.new()
p.FilterDescendantsInstances = {player.Character}
p.FilterType = Enum.RaycastFilterType.Blacklist
local re = workspace:Raycast(script.Parent.Pistol.Model.Aim_Sight.Pat.Position,(mousePos - script.Parent.Handle.Position)*400,p)
if re then
local hi = re.Instance
local mo = hi:FindFirstAncestoOfClass("Model")
if mo then
if mo:FinFirstChild("Humanoid") then
mo.Humanoid.Health -= 30
end
end
end
end)
This is the error
FindFirstAncestoOfClass is not a valid member of Part “Workspace.Test Dummy.Torso”