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

Team Specific Lobby Script (help?)

Asked by 8 years ago

If someone could help me that would be great! I was wondering if someone could help me modify this script to that It has red and blue team spawns and when the round starts it gives team-specific weapons from lighting or some other place and then when the round ends it takes away the weapons.

01local oldMessage = ""
02local minPlayers = 2
03 
04function teleportAllPlayers()
05    local target = CFrame.new(workspace.TeleportTarget.Position)
06    for i, player in ipairs(game.Players:GetChildren()) do
07        player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
08        player.Playing.Value = 1
09        --add an offset of 5 for each character
10    end
11end
12 
13function message(message)
14    if oldMessage ~= message then
15        oldMessage = message
View all 51 lines...

2 answers

Log in to vote
0
Answered by
Zrxiis 26
8 years ago
Edited 8 years ago

Make a function for when the round starts. Put the items you want for the player in a folder in ReplicatedStorage. In the function that runs when the round has started put this.

01--//Services
02local RepStorage = game:GetService("ReplicatedStorage")
03local teams = game:GetService("Teams")
04 
05--//Teams
06local teamblue = Instance.new("Team")
07teamblue.Name = "TeamBlue"
08teamblue.Parent = teams
09teamblue.TeamColor = BrickColor.new("Really blue")
10local teamred = Instance.new("Team")
11teamred.Name = "TeamRed"
12teamred.Parent = teams
13teamred.TeamColor = BrickColor.new("Really red")
14 
15--//Giving the player items
View all 26 lines...

Now make a function for when the round ends. In it put this.

1player.Backpack:remove() --// Removes the items from the players backpack
01--//Teleporting the player
02 
03local blueteamspawn = game.Workspace.Part --//Change this to the target brick
04local redteamspawn = game.Workspace.Part --//Change this part to the target brick
05 
06if player.Team == teamblue then
07    if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
08        player.Character.HumanoidRootPart.CFrame = blueteamspawn.CFrame + Vector3.new(0,5,0)
09    end
10elseif player.Team == teamred then
11    if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
12        player.Character.HumanoidRootPart.CFrame = redteamspawn.CFrame +                                               
13        Vector3.new(0,5,0)
14    end
15end

I believe this should work for creating the teams and giving the player items, but I don't know how to set teams. Make sure that the giving player items script is in a server script so that it can access the service "ReplicatedStorage" and "Teams".

For setting the teams look at this person's question. https://scriptinghelpers.org/questions/11208/how-can-i-split-up-teams-in-a-script

0
Thank you so much i will try it out! nateatron6 2 — 8y
0
Sorry to bother you again but I tried to create a function called function giveweapons and put everything underneath it, but it didn't work. I was also wondering I have a brick called teleport target where the players spawn to do you think you could help me make a teleport target for each team color? nateatron6 2 — 8y
0
DId you put the items in replicated storage? Zrxiis 26 — 8y
0
Put the teleportation script at the bottom. Zrxiis 26 — 8y
View all comments (2 more)
0
Oh ok I will put functions above at the top of the lobby script i made with the teleportation functions underneath. I did put the weapons in replicated storage but it keeps underlining local in blue on line 2 of the giving weapons script. Thanks so much for your help! nateatron6 2 — 8y
0
@fang please look below at my finished script please revise it nateatron6 2 — 8y
Ad
Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

Dear Fang please look at this and revise, your work is much appricaited! So the script in whole should look something like this FN Fal is the gun i have in replicated storage

001local oldMessage = ""
002local minPlayers = 2
003 
004function teleportAllPlayers() --What do i have this for if i have teamspawning below in function EndRoundTakeWeps??? please comment below fang
005    local target = CFrame.new(workspace.TeleportTarget.Position)
006    for i, player in ipairs(game.Players:GetChildren()) do
007        player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
008        player.Playing.Value = 1
009        --add an offset of 5 for each character
010    end
011end
012 
013function message(message)
014    if oldMessage ~= message then
015        oldMessage = message
View all 103 lines...
0
@Fangblade16 The two main points I have is the teleportAllPlayers function why do I need that if i have the local blueteamspawn part in function RoundEndTakeWeps. Also you think your could help me make text gui popups for round ending and starting. Thank for all the help!! nateatron6 2 — 8y
0
If you are setting the players teams before you teleport them then in your teleport players function under you for loop replace that part with the teamspawn part, but make sure you set the players teams before teleporting them or it will not work Zrxiis 26 — 8y
0
What output error does it give for the giving players items function Zrxiis 26 — 8y
0
I am going to test it sometime today but i canot right now do you think you could re-explain the people spawning im confused about it. So in the game i have 3 teams red, blue and spectator. So do i delete the teleportAllPlayers function or what. Sorry on my part nateatron6 2 — 8y
View all comments (9 more)
0
When teleporting a player you cant move any body parts using "Position" because it would break the model thus killing the player so you have to change the CFrame property instead. This is the roblox wiki article on teleporting the player:http://wiki.roblox.com/index.php?title=Teleportation Zrxiis 26 — 8y
0
And you just need to create another team for the neutral players so that if their on that team they dont get weapons and wont teleport. You could delete the teleportAllPlayers if you wanted to, but u have to make the teleport part of the script run at the time the round starts. If u want to make a gui pop out of the screen then go to the roblox wiki and search up Tweening. Zrxiis 26 — 8y
0
Hope this helps. Zrxiis 26 — 8y
0
Thank you so much for the clarification, so from what i get I create a neutral team (Spectators) and I Can delete the teleport all players But, I must look at the part of the code that says local redteamspawn = game.Workspace.Part (I would change "Part" to what ever the target brick is for instance Redtele for red correct? nateatron6 2 — 8y
0
yes, sorry for late answer Zrxiis 26 — 8y
0
please help me sorry for not understanding i am so new to this here is the team create: https://www.roblox.com/games/678188380/Working-on-a-war-game nateatron6 2 — 8y
0
please accept my roblox freind request nateatron6 2 — 8y
0
turn on team create, invite me, and i will look at the script. Zrxiis 26 — 8y
0
I will do that today in about 5 hours (School rn) nateatron6 2 — 8y

Answer this question