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

Solitary is not a valid member of Teams "Teams"? this is a server script

Asked by 2 years ago

--[[ Brief : Solitary Confinement Manager Author : Hereticia/AloysiusLazvari/DeverusLazvari/Dev_Chaos Description : Module utilized to manage and keep stored all Solitary Confinement Data. Notes : No, this isn't for credit because only people who look at this damned script will see it. It's for maintenance and knowledge purposes, so you can contact me if needed.

RESCRIPTED BY WELPNATHAN

--]]


-- V A R I A B L E S --

local collectionService = game:GetService('CollectionService') local datastoreService = game:GetService('DataStoreService') local teams = game:GetService('Teams') local players = game:GetService('Players')

-- DataStoreService local datastore = datastoreService:GetDataStore('SolitaryStore')

local solitaryTriggers = script.Parent:WaitForChild('Solitary') local teamColor = teams['Class-D'].TeamColor local solitaryColor = teams['Solitary'].TeamColor


-- M A I N S C R I P T --

players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function() if player.TeamColor == teamColor then local success, val = pcall(function() return datastore:GetAsync(player.UserId) end) if not success then return warn('SOLITARY | Could not get player data for ' .. player.Name) end if val and val > 0 then collectionService:AddTag(player, 'Solitary') local randomPosition = solitaryTriggers:GetChildren()[math.random(1, #solitaryTriggers:GetChildren())] randomPosition = randomPosition.CFrame + Vector3.new(math.random(-5, 5), 2, 0) player.Character.HumanoidRootPart.CFrame = randomPosition print('SOLITARY | ' .. player.Name .. ' was placed into solitary based on past history.') end end end) end)

for _, part in pairs(solitaryTriggers:getChildren()) do part.Touched:Connect(function(hit) local player = players:GetPlayerFromCharacter(hit.Parent) if player and player.Character and player.Character:FindFirstChild('Humanoid') and player.Character.Humanoid.Health > 0 then if player.TeamColor == teamColor then if not collectionService:HasTag(player, 'Solitary') then collectionService:AddTag(player, 'Solitary') print('SOLITARY | ' .. player.Name .. ' has been placed in solitary.') end player.Character.Humanoid:UnequipTools() if player.Backpack then player.Backpack:ClearAllChildren() end end end end) end

collectionService:GetInstanceAddedSignal('Solitary'):Connect(function(player) if player.TeamColor == teamColor then local success, val = pcall(function() return datastore:GetAsync(player.UserId) end) if not success then return warn('SOLITARY | Could not get player data for ' .. player.Name) end if not val or val == 0 then local success = pcall(function() return datastore:SetAsync(player.UserId, 660) end) if not success then warn('SOLITARY | Could not set player data for ' .. player.Name) end end end end)

while true do wait(60) local jailed = collectionService:GetTagged('Solitary') for _, player in pairs(jailed) do local val = datastore:GetAsync(player.UserId) if val - 60 == 0 or val - 60 < 0 then datastore:SetAsync(player.UserId, 0) player:LoadCharacter() collectionService:RemoveTag(player, 'Solitary') print('SOLITARY | ' .. player.Name .. ' has been released from solitary.') else datastore:SetAsync(player.UserId, val - 60) print('SOLITARY | ' .. player.Name .. ' has ' .. tostring((val-60)/60) .. ' minutes of solitary confinement remaining.') end end end

0
WOW ROBLOX IS gay LYESPILLEDINMYEYES -14 — 2y
0
So that's why Roblox is gay DisasterHotelGiant 0 — 2y
0
WHY ARE YOU GUYS SO DUMB? OH MY GOD I WANT TO KILL MYSELF yuri1104 0 — 2y
0
By drinking some yummy Bleach yuri1104 0 — 2y
View all comments (2 more)
0
Roblox is broken 67peicbm46bv8buws8ig 0 — 2y
0
CALL BIN LADEN AT BIN LADEN 1111-3333-3333-1111 SUPPORT 67peicbm46bv8buws8ig 0 — 2y

Answer this question