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

Kick tried to index with nil when trying to run player:Kick() how do i fix this?

Note sorry about messy code,

New to lua so it is really messy. Sorry.

Kick script at the bottom


function aaa(player)
	wait(20)
	
	local Target = game.Workspace.LandonUntermeyer
	local humanoid = Target.Humanoid


	local Node = game.Workspace.AINODES.Target.AINode1

	humanoid:MoveTo(Node.Position)
	wait(5)

	local Target = game.Workspace.LandonUntermeyer
	local humanoid = Target.Humanoid

	local Node = game.Workspace.AINODES.Target.AINode2


	humanoid:MoveTo(Node.Position)
	wait(5)

	local Target = game.Workspace.LandonUntermeyer
	local humanoid = Target.Humanoid


	local Node = game.Workspace.AINODES.Target.AINode3




humanoid:MoveTo(Node.Position)
function shake()
	local players = game.Players:GetPlayers()
	for i=1, #players do
		local character = players[i].Character
		local shakescript = character:FindFirstChild("ShakeScript")
		if shakescript ~= nil then
			shakescript.Disabled = false
		end
	end
end

script.ShakeScriptAdder.ShakeScript.Disabled=false
shake()
	wait(20)
	player:kick("Failed Mission [Target Escaped.]")
end

aaa()

1 answer

function aaa(player)
    wait(20)

    local Target = player.Character
    local humanoid = Target.Humanoid


    local Node = game.Workspace.AINODES.Target.AINode1

    humanoid:MoveTo(Node.Position)
    wait(5)

    local Target = player.Character
    local humanoid = Target.Humanoid

    local Node = game.Workspace.AINODES.Target.AINode2


    humanoid:MoveTo(Node.Position)
    wait(5)

    local Target = player.Character
    local humanoid = Target.Humanoid


    local Node = game.Workspace.AINODES.Target.AINode3


humanoid:MoveTo(Node.Position)
function shake()
    local players = game.Players:GetPlayers()
    for i=1, #players do
        local character = players[i].Character
        local shakescript = character:FindFirstChild("ShakeScript")
        if shakescript ~= nil then
            shakescript.Disabled = false
        end
    end
end

script.ShakeScriptAdder.ShakeScript.Disabled=false
shake()
    wait(20)
	if player then
		    player:kick("Failed Mission [Target Escaped.]")
	end
end

aaa(PLAYER) -- you arent putting player into here

do this instead if the game's single player
aaa(game.Players:GetChildren()[1])

3 comments

0

But now it wont even give me a error or kick me

0

dnc

0

why? if you dont care then just dont post to this

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