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

So I'm trying to make a team change block that respawns you onto a spawn, but it won't work?

So what I'm trying to do is make it so I can just copy the team block and change literally 2 values and boom, so I don't have to make all my code different and make it take years to change every little thing, but part of it isn't working, and the error I'm getting is "Arguement 1 missing or nil", here is my code.

local value = script.Parent.spawn.Value -- The value its reading is a string value that is called what the spawn block is called, in this case its "evilspawn", but thats not really important

local teemspawn = workspace:FindFirstChild(teamspawns):FindFirstChild(""..value.."") -- This is the part it seems to break on, this is trying to find where in the folder called "teamspawns" the spawn block is.
script.Parent.Touched:connect(function(Hit) -- none of this function is important.
Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player then
Player:LoadCharacter()
Player.Character.Torso.Position = teemspawn.Position * (Vector3.new(0, 5, 0))
end 
end)

1 answer

Here is the line that has error:

local teamspawn = workspace:FindFirstChild(teamspawns)

teamspawns should be a string.

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