Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
0
Answered by
iuclds 720 Moderation Voter
3 years ago
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])

0
But now it wont even give me a error or kick me goldenlandon 0 — 3y
0
dnc iuclds 720 — 3y
0
why? if you dont care then just dont post to this goldenlandon 0 — 3y
Ad

Answer this question