Advertisement
Xoaxxe

Untitled

May 22nd, 2020
1,957
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.42 KB | None | 0 0
  1. --The first thing you want to do is check if the player is in one of the groups, to do this you would do the following,
  2.  
  3. game.Players.PlayerAdded:Connect(function(newPlayer)             -- this calls the function whenever a new user joins the game, "newPlayer" could be called anything what matters is that with the PlayerAdded function this is always equal player name
  4.    if newPlayer:IsInGroup(7) then                                -- here you check if newPlayer is in a specific group, the id "7" would be your group id          
  5.       print("This user is in the group.")                        -- this is what happens if they are in the group    
  6.    end                                                           -- here they close the if statement
  7. end)                                                             -- here they close the function
  8.  
  9.                                                                  -- now that we have checked if they are in the group we need to decide what happens if they are in the group, I recommend you rename the spawnpoints to something relating to the group name, for example, if the group name is "Group name" then you should rename its spawnpoint to something like "GroupNameSpawn"
  10.  
  11. game.Workspace.DefaultSpawn:Destroy()                            -- the part "game.Workspace.DefaultSpawn" is just the location of the default spawn, ":Destroy()" deletes that part, but just remember to put this in a local script so that it doesn't destroy the spawn for everyone
  12. local GroupSpawn = Instance.new("SpawnLocation", game.Workspace) -- here we create a new spawn point and set its parent to the workspace, the reason we make it a variable is so that we can edit it more separately from this statement
  13. GroupSpawn.Name = "GroupSpawn"                                   -- here we change the name of the spawn itself, because before the name was just a variable, and not actually the name of the spawn
  14. GroupSpawn.Position = Vector3.new(0, 0, 0)                       -- replace the zero's with the position you want the spawn, if you dont know then place a part where you want it and copy its position and paste it into the (), make sure it is formatted the same as the zeros.
  15.  
  16.  
  17. -- the final result should look sommething like this:
  18. game.Players.PlayerAdded:Connect(function(newPlayer)
  19.     if newPlayer:IsInGroup(7) then
  20.         game.Workspace.DefaultSpawn:Destroy()
  21.         local GroupSpawn = Instance.new("SpawnLocation", game.Workspace)
  22.         GroupSpawn.Name = "GroupSpawn"
  23.         GroupSpawn.Position = Vector3.new(0, 0, 0)
  24.     end
  25. end)
  26.  
  27. -- make sure that you replace the group id with the group you want it to check for and the vector3 position with the position on the spawn
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement