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

ServerScriptService.Game Logic.RoundModule:32: attempt to index nil with 'Name' ?

local module = {}

local status = game.ReplicatedStorage:WaitForChild("Status")

function module.Intermission(length)
	for i = length,0,-1 do
		status.Value = "Next round starts in "..i.." seconds"
		wait(1)
	end
end

function module.SelectChapter()
	local rand = Random.new()
	local chapters = game.ReplicatedStorage.Chapters:GetChildren() -- Table of all map models
	local chosenChapter = chapters[rand:NextInteger(1,#chapters)]
	
	return chosenChapter
end

function module.ChoosePiggy(players)
	
	local RandomObj = Random.new()
	
	local chosenPiggy = players[RandomObj:NextInteger(1,#players)]
	
	return chosenPiggy
	
end

function module.DressPiggy(Piggy)
	local character = game.ServerStorage.Piggy:Clone()
	character.Name = Piggy.Name
	
	Piggy.Character = character
	
	character.Parent = workspace
end

return module


and it says that character.Name = Piggy.Name is the problem

1 comment

0

Tell us what you're passing through when you're calling the "DressPiggy" method. Or else we can't do anything.

1 answer

Try use:

if value == nil then
	warn("Error")
	--script
end

or

 if value:FindFirstChild("Name") == nil then
	warn("Error")
	--script
end

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