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

Why doesn't this script work?

Asked by
jqrx 0
8 years ago

Okay, this is a big job for you guys. But it keeps saying every value is nil. Why????

local copy
local torso
local your_torso
local pos
local able = true
local You
You = Workspace:FindFirstChild("FMScript")
You.Archivable = true
cloning = coroutine.create(function()
    copy = You:Clone()
    copy.Parent = workspace
    torso = copy["Torso"]
    torso.CFrame = torso.CFrame * CFrame.new(0,8,0)
    copy:makeJoints()
    your_torso = workspace["FMScript"].Torso
    for i,v in pairs(copy:GetChildren()) do
        if v:IsA("Part") then
            v.Color = BrickColor.new("Black").Color
        end
    end
end)
follow = coroutine.create(function()
    while able == true do
        wait()
        torso.CFrame = your_torso.CFrame * CFrame.new(0,0,8)
        pos = torso.CFrame:lerp(your_torso.CFrame,.2)
        torso.CFrame = pos
    end
end)
coroutine.
You:GetPlayerFromCharacter("FMScript").Chatted:connect(function(msg,rec)
    if msg == "come from the depths of hell" or "come from hell" then
        copy.Parent = workspace
    end
    if msg == "begone" then
        copy.Parent = game.Lighting
    end
    if string.sub(msg,1,7) == "attack " then
        local player = game.Players:FindFirstChild(string.sub(msg,8))
        if player then
            if player.Character then
                if copy.Parent == workspace then
                    able = false
                    torso.CFrame = player.Character["Torso"].CFrame
                    player.Character:BreakJoints()
                    able = true
                else
                    return
                end
            end
        end
    end
end)

30: attempt to index field 'game'/'You' a nil value

0
Coroutine on line 30 is not finished, also just creating a coroutine does not mean it will be ran, so use coroutine.wrap(function)() or coroutine.create(coroutine.resume(function)). M39a9am3R 3210 — 8y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

If you look at line 30, it says coroutine. and that is all it says. It looks like you started to write something and then stopped writing it and tried to run the script before you finished. Remove that line or finish whatever you were writing.

Ad

Answer this question