local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
mouse.Button1Down:connect(function()
local human = mouse.Hit:FindFirstChild("Humanoid")
if human then
local explosion = Instance.new("Fire")
explosion.Parent = human
if not human then
print("no human found, sorry.")
end
end
end)
i have an error: FindFirstChild is not a valid member of CFrame.
mouse.Hit describes the position of the mouse
mouse.Target describes the object it is touching
1 Like
mouse.Hit
should be mouse.Target
if you want to find the thing that mouse touched, make sure you check if it’s not nil before trying to use FindFirstChild on it as it would error again!
1 Like
Thank you!!! you always solve my problems!!! have a good day!!
1 Like
Anytime! If you hae anymore issues don’t e afraid to make another post!
1 Like
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
mouse.Button1Down:connect(function(plr)
local human = mouse.Target:FindFirstChildWhichIsA("Humanoid")
if human ~= nil then
local explosion = Instance.new("Fire")
explosion.Enabled = true
if explosion.Enabled ~= false then
explosion.Parent = human
print("This is my parent:"..explosion.Parent)
end
end
end)
I didn’t see the solution but here.