generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Strange Error For Rejoining Same Server

Previous Thread :: Next Thread 
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
14 Nov 2016 07:36 PM
--*** means D-a-t-a-S-t-o-r-e, it's censored out by Roblox.
--For some reason, if someone on the GroupTeam rejoins a server, they don't respawn with their weapons or their Prisoner bool value. Please help and tell me if I miss anything. Good luck! Thanks in advance.

local *** = game:GetService("***Service"):Get***("JailedList")

local playerName

local allyTeam = "Allies"--Name of the team for the allies
local allySpawn = "AllySpawn"--Name of the spawn for allies
local allyWeapons = {"AllySabre"}--List of weapons for the allies
local allyID = 0--ID of an ally group

allyTeam = game.Teams:FindFirstChild(allyTeam)
allySpawn = game.Workspace:FindFirstChild(allySpawn)

local citizenTeam = "Citizens"--Name of the team for citizens (A#######################i############ "C####################f the spawn for citizens
local citizenWeapons = {}--List of weapons for the citizens

citizenTeam = game.Teams:FindFirstChild(citizenTeam)
citizenSpawn = game.Workspace:FindFirstChild(citizenSpawn)

local hostileTeam = "Hostiles"--Name of the team for hostiles
local hostileSpawn = "HostileSpawn"--Name of the spawn for hostiles
local hostileWeapons = {"HostileSabre"}--List of weapons for the hostiles
local hostileID = 0--ID of a hostile group

hostileTeam = game.Teams:FindFirstChild(hostileTeam)
hostileSpawn = game.Workspace:FindFirstChild(hostileSpawn)

local prisonerTeam = "Prisoners"--Name of the team for prisoners
local prisonerSpawn = "PrisonerSpawn"--Name of the spawn for prisoners

prisonerTeam = game.Teams:FindFirstChild(prisonerTeam)
prisonerSpawn = game.Workspace:FindFirstChild(prisonerSpawn)

local groupTeam = "The Lumiere Paladins"--Name of the team for the main group
local groupSpawn = "TLPSpawn"--Name of the spawn for the main group
local groupBasicWeapons = {"TLPSabre"}--List of weapons for the main group
local groupAdvancedWeapons = {"Handcuffs"}--List of weapons for the main group
local groupID = 2980186--ID of the main group
local lowRank = 5--Rank in group you need to be to be in the group team and have basic group weapons
local highRank = 230--Rank in group you need to have advanced group weapons

groupTeam = game.Teams:FindFirstChild(groupTeam)
groupSpawn = game.Workspace:FindFirstChild(groupSpawn)

game.Players.PlayerAdded:connect(function(player)
playerName = player.Name
player.TeamColor = citizenTeam.TeamColor

if player:IsInGroup(allyID) then
player.TeamColor = allyTeam.TeamColor
player.Character.Torso.CFrame = CFrame.new(allySpawn.Position)
end

if player:GetRankInGroup(groupID) >= lowRank then
player.TeamColor = groupTeam.TeamColor
player.Character.Torso.CFrame = CFrame.new(groupSpawn.Position)
end

if player:IsInGroup(hostileID) then
player.TeamColor = hostileTeam.TeamColor
player.Character.Torso.CFrame = CFrame.new(hostileSpawn.Position)
end
-------------works till here for group team, works entirely for everyone else
player:WaitForDataReady()

local key = "player_" .. player.userId or 0

local prisoner = Instance.new("BoolValue", player)
prisoner.Name = "Prisoner"
prisoner.Value = ***:GetAsync(key)

if prisoner.Value == true then
player.TeamColor = prisonerTeam.TeamColor
player.Character.Torso.CFrame = CFrame.new(prisonerSpawn.Position)
end

if player.TeamColor == groupTeam.TeamColor and player.Prisoner.Value == false then
if player:GetRankInGroup(groupID) >= highRank and #groupAdvancedWeapons > 0 then
for i = 1, #groupAdvancedWeapons do
local clone1 = game.ServerStorage:WaitForChild(groupAdvancedWeapons[i]):Clone()
clone1.Parent = player.StarterGear

local clone2 = game.ServerStorage:WaitForChild(groupAdvancedWeapons[i]):Clone()
clone2.Parent = player.Backpack
end
end

if player:GetRankInGroup(groupID) >= lowRank and #groupBasicWeapons > 0 then
for i = 1, #groupBasicWeapons do
local clone1 = game.ServerStorage:WaitForChild(groupBasicWeapons[i]):Clone()
clone1.Parent = player.StarterGear

local clone2 = game.ServerStorage:WaitForChild(groupBasicWeapons[i]):Clone()
clone2.Parent = player.Backpack
end
end
elseif player.TeamColor == allyTeam.TeamColor and #allyWeapons > 0 then
for i = 1, #allyWeapons do
local clone1 = game.ServerStorage:WaitForChild(allyWeapons[i]):Clone()
clone1.Parent = player.StarterGear

local clone2 = game.ServerStorage:WaitForChild(allyWeapons[i]):Clone()
clone2.Parent = player.Backpack
end
elseif player.TeamColor == hostileTeam.TeamColor and #hostileWeapons > 0 then
for i = 1, #hostileWeapons do
local clone1 = game.ServerStorage:WaitForChild(hostileWeapons[i]):Clone()
clone1.Parent = player.StarterGear

local clone2 = game.ServerStorage:WaitForChild(hostileWeapons[i]):Clone()
clone2.Parent = player.Backpack
end
elseif player.TeamColor == citizenTeam.TeamColor and #citizenWeapons > 0 then
for i = 1, #citizenWeapons do
local clone1 = game.ServerStorage:WaitForChild(citizenWeapons[i]):Clone()
clone1.Parent = player.StarterGear

local clone2 = game.ServerStorage:WaitForChild(citizenWeapons[i]):Clone()
clone2.Parent = player.Backpack
end
end
end)

game.Players.PlayerRemoving:connect(function(player)
local key = "player_" .. player.userId or 0
local valueToSave = (player.Prisoner.Value)

***:SetAsync(key, valueToSave)
end)


--Online
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
14 Nov 2016 07:56 PM
I'm a little bit disappointed. Why isn't anyone responding?


--Online
Report Abuse
Thedagz is not online. Thedagz
Joined: 10 Mar 2012
Total Posts: 798
14 Nov 2016 07:57 PM
is there a line of error?
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
14 Nov 2016 08:09 PM
I can't check because you can't rejoin a server in studio's testing mode.


--Online
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
14 Nov 2016 08:13 PM
Anybody?


--Online
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
14 Nov 2016 08:17 PM
Nobody?


--Online
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
14 Nov 2016 08:24 PM
Bump.


--Online
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
14 Nov 2016 08:32 PM
Please help.


--Online
Report Abuse
VineyardVine is not online. VineyardVine
Joined: 20 Nov 2010
Total Posts: 904
14 Nov 2016 08:33 PM
People dont tend to respond when you give them tons of code to read through and dont even give hint of where to look
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
15 Nov 2016 07:22 PM
I would show less code if I could, but I have no idea where it goes wrong. Bump.


--Online
Report Abuse
OnlineOne is online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
19 Nov 2016 11:02 AM
bump


--Online
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image