Im trying to make a script [this script in bullet] that if you shoot wrong guy you also die and gun pops up above you, But its not working [Out says: line 3, "humanoid" a nil value
function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Humanoid") if humanoid.Parent.Name == not Workspace.Trouble.Value then script.Parent.Parent:BreakJoints() script.Parent.Parent.Colt.Handle.Position = script.Parent.Parent.Torso.Handle.Position + Vector3.new(0,2,0) humanoid.Parent.Colt.Handle.Anchored = true local sm = Instance.new("Smoke") sm = Instance.new("Smoke") sm.Name = "Smoke" sm.Color = Color3.new(0,85/255,1) sm.Opacity = 0.5 sm.Parent = script.Parent.Parent.Colt.Handle sm.Enabled = true else if humanoid.Parent.Name == Workspace.Trouble.Value then Workspace.TroubleDead.Value = true wait() end end end function tagHumanoid(humanoid) -- todo: make tag expire local tag = ball:findFirstChild("creator") if tag ~= nil then local new_tag = tag:clone() new_tag.Parent = humanoid debris:AddItem(new_tag, 1) end end script.Parent.Touched:connect(onTouched)
function onTouched(hit) if hit.Parent:FindFirstChild("Humanoid") then --Want to see if humanoid exists or if you just hit a wall. local humanoid = hit.Parent:findFirstChild("Humanoid") if not humanoid.Parent.Name == Workspace.Trouble.Value then --And not should start the If Then Statement. script.Parent.Parent:BreakJoints() script.Parent.Parent.Colt.Handle.Position = script.Parent.Parent.Torso.Handle.Position + Vector3.new(0,2,0) humanoid.Parent.Colt.Handle.Anchored = true local sm = Instance.new("Smoke") sm = Instance.new("Smoke") sm.Name = "Smoke" sm.Color = Color3.new(0,85/255,1) sm.Opacity = 0.5 sm.Parent = script.Parent.Parent.Colt.Handle sm.Enabled = true else if humanoid.Parent.Name == Workspace.Trouble.Value then Workspace.TroubleDead.Value = true wait() end end end end function tagHumanoid(humanoid) -- todo: make tag expire local tag = ball:findFirstChild("creator") if tag ~= nil then local new_tag = tag:clone() new_tag.Parent = humanoid debris:AddItem(new_tag, 1) end end script.Parent.Touched:connect(onTouched)