Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help fix this teleport - to - map script please?

Asked by
painzx3 43
10 years ago

I'm trying to make it so that instead of using a fixed location to teleport players to when a map is loaded, it teleports players of different teams to certain bricks with certain names within the map model. This is what I have so far, any changes made in this script please use this copy of the script and mark any changes you have made. Thanks!

team1 = Rpos.Vecto3  --.new(104.5, 155.299, -160.115)--change to where team1 spawns(red team) Note: use Vector3 cordinates
team2 = Bpos.Vector3  --.new(78.3, 155.299, -77.115)--change to where team2 spawns(blue team)
lobby = Lobby.Vector3  --.new(-1.256, 15.49, 41.299)-- change the the position of the lobby(where the players go before/after the game)
weapon = game.Lighting["Revolver"]-- change "Sword" to the name of the weapon you want players to have during the game. put the weapon in Lighting.if you want no weapons then remove this line.
Maps = {"Divide"}-- change Map1,Map2,Map3 to the name of your maps and put them in Lighting. you can add more just add: ,"another map" after Map3 and so on.
random = Maps[math.random(1,#Maps)]

while true do 
wait(30)-- how long between games.
script.map.Value = random
local m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = "Selecting map..."
wait(5)
m.Text = random.." has been chosen!"
wait(4)
g = game.Lighting[script.map.Value]:Clone()
g.Parent = game.Workspace
g:MakeJoints()
m.Text = "Teleporting Players"
wait(3)
m:remove()
d = weapon:Clone()
c = weapon:Clone()
local pplz = game.Players:GetChildren()
for i = 1,#pplz do 
if pplz[i].TeamColor == BrickColor.new("Bright red") and pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then-- change to team1's TeamColor
c.Parent = pplz[i].StarterGear
d.Parent = pplz[i].Backpack
pplz[i].Character.Torso.CFrame = team1
d = weapon:Clone()
c = weapon:Clone()
elseif pplz[i].TeamColor == BrickColor.new("Bright blue") and  pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then--change to team2's TeamColor
pplz[i].Character.Torso.CFrame = team2
d.Parent = pplz[i].Backpack
c.Parent = pplz[i].StarterGear
end end 
wait(15)-- how long each game lasts.
local pplz = game.Players:GetChildren()
for i = 1,#pplz do
if pplz[i] ~= nil and pplz[i].Character:FindFirstChild("Torso") ~= nil then 
local clean1 = pplz[i].StarterGear:GetChildren()
clean1[i]:remove()
local clean2 = pplz[i].Backpack:GetChildren()
clean2[i]:remove()
pplz[i].Character.Torso.CFrame = lobby
end end

local m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = "The round has ended!"
wait(4)
game.Workspace[script.map.Value]:remove()
--m.Text = winner.." has won!"
m:remove()
end

0
`Rpos.Vecto3`, you're missing the r in Vector. TofuBytes 500 — 10y
0
This is what pops up in the Output for the error: "Workspace.TeamGameScript:7: attempt to index global 'Rpos' (a nil value) painzx3 43 — 10y
0
Oh I saw that already, just added the 'r' and it still says the same error in the workspace painzx3 43 — 10y

Answer this question