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

Missing argument? Can someone help?

I was testing this script and on the Output is saying there's a missing argument, here's what it says:

23:07:05.802 - Argument 1 missing or nil 23:07:05.803 - Script 'Players.Player1.PlayerGui.ScreenGui.TextButton.LocalScript', Line 9 - global Down 23:07:05.803 - Script 'Players.Player1.PlayerGui.ScreenGui.TextButton.LocalScript', Line 26

Here's the script:

plr = game.Players.LocalPlayer
a = plr.Up.Value

function Down()
	for i,v in pairs(game.Workspace:GetChildren()) do
			if v.Name == "SpawnLocation" then
				vv = {v.Name}
				d = vv[math.random(1,#vv)]
				plr.Character.Humanoid:MoveTo(d.Position)
				a = false
			end
	end
end

function Up()
	for i,v in pairs(game.Workspace.Lobby:GetChildren()) do
		if v.Name == "SpawnLocationU" then
			vv = {v.Name}
			d = vv[math.random(1,#vv)]
				plr.Character.Humanoid:MoveTo(d.Position)
		end
	end
end
script.Parent.MouseButton1Down:connect(function()
	if a == true then
		Down()
	elseif a == false then
		Up()
	end
end)

1 answer

You could try this:

replace the for loops with this

ch = game.Workspace:GetChildren()
for i = 1, #ch do
	if ch[i].Name == "SpawnLocation" then
		d = ch[(math.random(1,#ch))]
		plr.Character.Humanoid:MoveTo(d.Position)
		a = false
	end
end

If it gives you any errors then please post them.

3 comments

0

Doesn't work.

0

That makes no sense at all...

0

You don't have to lower my reputation if it doesn't work you little no for good shroom.

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