I’m having trouble trying to understand why the players who are scp’s die the second they spawn.
There are no errors.
Script for class:
local Classes = {"Class-D", "Scientist", "Guard", "SCP"}
local Classdclass = game.ReplicatedStorage.Classdclass
local SCPClass = game.ReplicatedStorage.SCPClass
local ScientistClass = game.ReplicatedStorage.ScientistClass
local GuardClass = game.ReplicatedStorage.GuardClass
local Classd = 0
local MaxClassd = 8
local MaxScp = 2
local SCPS = 0
local PlayerClass = ""
Players = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(player)
for i, player in pairs(Players:GetPlayers()) do
PlayerClass = math.random(1, #Classes)
print(PlayerClass)
if PlayerClass == 1 and Classd < MaxClassd then
Classdclass:Fire(player) -- giving the player
Classd = Classd + 1 -- add one
else
if PlayerClass == 4 and SCPS < MaxScp then
SCPClass:Fire(player) -- giving the player
SCPS = SCPS + 1 -- add one
elseif SCPS > MaxScp then
print('max scps')
end
end
end
end)
script for scp
local SCPClass = game.ReplicatedStorage.SCPClass
local scp1 = game.ReplicatedStorage:FindFirstChild("173")
local SCPClass2 = game.ReplicatedStorage.SCPClass
local scp2 = game.ReplicatedStorage:FindFirstChild("049")
local SCP173FOVEVENT = game.ReplicatedStorage.scp173fovevent
local player = game.Players.PlayerAdded
local Max173 = false
local Max049 = false
local scpscript = scp1.Script
function scp173(player)
if Max173 == false then
Max173 = true
morph = scp1:Clone()
morph.Name = player.Name
player.Character = morph
morph.Parent = workspace
scpscriptclone = scpscript:Clone()
scpscriptclone.Parent = game.StarterPlayer.StarterCharacterScripts
SCP173FOVEVENT:Fire()
else if Max173 == true then
if Max049 == false then
morph2 = scp2:Clone()
morph2.Name = player.Name
player.Character = morph
morph2.Parent = workspace
end
end
end
end
SCPClass.Event:Connect(scp173)