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

Why does this give me an error??

Luckily, the output says Line 3, so I don't have to put all 125 lines of code. But this error makes no sense. The whole script is in a LocalScript.

Works in Play solo, but not in Online...

Character = game.Players.LocalPlayer.Character
wait(5)
Torso = Character.Torso --Aparently, the error is here...
mode = Instance.new("Model")
mode.Name = "Raggy"
mode.Parent = game.Workspace
face = 145952218

Output: attempt to index global 'Character' (a nil value)

2 answers

Just to be sure, you can try:

player = game.Players.LocalPlayer
repeat wait() until player.Character
character = player.Character

1 comment

0

Hopefully, this will work. If it doesn't, there may be something wrong with your game.

You define character before the character is loaded, thus making it equal nil. To fix this, simply delay the code until the character is loaded.

local plr = game.Players.LocalPlayer
	repeat wait() until plr.Character
local chr = plr.Character

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