Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Sheriff gun like in Murder Mystery problem? [ERROR]

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)



1 answer

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)

3 comments

0

I'll test it out..

0

Nope.

0

What's the problem now?

This discussion is preserved as it was. New answers, comments, and votes are closed.