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

My script is saying Character is not a valid member of Scrip. What should i do?

so i have done some scripting and it hasn't been working every time I try it it says: Character is not a valid member of Script. I am new to scripting and need some help. Here is my scripting:

local seconds = game.Workspace.Time local ingame = game.Workspace.InGame.Value local Game = game.Workspace.Game.Position

while true do

wait(1) seconds.Value = seconds.Value - 1

if seconds.Value == 0 and ingame == 0 then

ingame = 1 seconds.Value = 390

local teleport = game.Players:GetChildren() for i = 1, #teleport do teleport[i].Character:MoveTo(Vector3.new(Game.X, Game.Y, Game.Z))

end end

if seconds.Value == 0 and ingame == 1 then

ingame = 0 seconds.Value = 15

local teleport = game.Players:GetChildren() for i = 1, #teleport do teleport[i]:LoadCharacter()

end end

end

1 answer

  1. Your scripting is extremely messy, if you wish to create a code block which looks wayy more professional, click the "Lua" button while typing your question, and place the code inside the brackets it generates,
  2. DO NOT set a variable to a word that is already being used by the studio, line 3 is an example of that, DO NOT SET A VARIABLE TO GAME, I changed it for you..

Im not promising this will work, your code was extremely messy and hard to read, so it's pretty hard to fix..

local seconds = game.Workspace.Time 
local ingame = game.Workspace.InGame.Value 
local gamePos = game.Workspace.Game.Position

while true do
	wait(1) seconds.Value = seconds.Value - 1

	if seconds.Value == 0 and ingame == 0 then

		ingame = 1 seconds.Value = 390

		local players = game.Players
		for i, player in pairs(players:GetChildren()) do
			local character = player.Character
			character.HumanoidRootPart.CFrame = PART TO TELEPORT TO.CFrame
		end
	end 

	if seconds.Value == 0 
	and ingame == 1 then

	ingame = 0 seconds.Value = 15

	local teleport = game.Players:GetChildren() 
	for i = 1, #teleport do 
		teleport[i]:LoadCharacter()
	end

	end
end

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