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

Why doesn't this script work?

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

1 comment

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)).

1 answer

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.

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