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

Why Is This Not Working?

Asked by
Benqazx 108
8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
local player = game.Players:FindFirstChild(script.Parent.name.Value)
        if (game.Workspace:FindFirstChild(script.Parent.name.Value).Torso.Position - game.Workspace:FindFirstChild(script.Parent.name.Value.. "'s Cop").Torso.Position).magnitude < 100 then
            script.Parent.Active.Disabled = false
            script.Parent.NonActive.Disabled = true
        else if (game.Workspace:FindFirstChild(script.Parent.name.Value).Torso.Position - game.Workspace:FindFirstChild(script.Parent.name.Value.. "'s Cop").Torso.Position).magnitude > 100 then
            script.Parent.Active.Disabled = true
            script.Parent.NonActive.Disabled = false
            end
end

this script will not work i dont know what is wrong with it. in the output it says Workspace.touchme.Script:2: attempt to index a nil value

0
One (or both) of the torsos don't exist. I'd help you fix it but this code is just too messy and I don't know where the values and stuff are located.... or even how it's supposed to work. ObscureEntity 294 — 8y

Answer this question