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

attempt to index field, a string value?

For some reason in the output it said "Workspace.Map Generator:26: attempt to index field 'Value' (a string value)" for line 26 but when I had the basically the same line of code in other places and it worked fine. Here is the code:


local TopText = script.TopText
while true do
	timer = 60
	repeat
		timer = timer-1
		TopText.Value = "Intermission ("..timer..")"
		wait(1)
	until timer == 0
	TopText.Value = "Picking Random Map..."
	wait()
	m = game.Lighting.Maps:GetChildren()
	r = math.random(1,#m)
	map = m[r]:clone()
	map.Parent = workspace
	TopText.Value = "The Map Chosen Was "..map.Name.."!"
	local Spawn = map.Spawn
	wait(5)
	plrs = game.Players:GetChildren()
	for i = 1, #plrs do
		plrs[i].Character:MoveTo(map.Spawn.Spawn.Position+Vector3.new(math.random(-5,5),0,math.random(-5,5)))
	end
	wait()
	timer = 30
	repeat
		timer = timer-1
		TopText.Value.Text = ""..timer.." Seconds Until The Wall"
		wait(1)
	until timer == 0
	Wall = game.ServerStorage.Wall:Clone()
	Wall.Parent = map
	Wall.Position = Spawn.Position
		
	map:remove()
end

if you figure out the reason please tell and thank you to in advance if anyone finds the problem.

1 comment

0

"TopText.Value.Text" change this to "TopText.Value"

1 answer

✓ Accepted answer

You put .Value.Text so Text is not in the Value. Change it.

TopText.Value = ""..timer.." Seconds Until The Wall"

1 comment

0

thank you

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