MainServer

 avatar
unknown
lua
2 years ago
3.8 kB
8
Indexable
script.Parent = game:GetService("ServerScriptService")

script.Name = "TitanOS"


function Gather()
	for i,v in pairs(script:GetChildren()) do
		if v:IsA("Folder") then
			if string.find(v.Name,"Scripts") then
				v.Parent = game:GetService("StarterPlayer"):WaitForChild(v.Name)
				v.Name = "TitanOS"..v.Name
			else
				v.Parent = game:GetService(v.Name)
				v.Name = "TitanOS"..v.Name
			end
		end
	end
end


Gather()

local VFXModule =require (game:GetService("ReplicatedStorage"):WaitForChild("TitanOSReplicatedStorage"):WaitForChild("Modules"):WaitForChild("Effects"))
local remotes = game:GetService("ReplicatedStorage"):WaitForChild("TitanOSReplicatedStorage"):WaitForChild("Remotes")

local TitanModule = require(game:GetService("ReplicatedStorage"):WaitForChild("TitanOSReplicatedStorage"):WaitForChild("Modules").TitanModule)
local Storage = game:GetService("ReplicatedStorage"):WaitForChild("TitanOSReplicatedStorage")

local Remotes = Storage:WaitForChild("Remotes")
local TitanEvent = Remotes:WaitForChild("Effects")


remotes:WaitForChild("IsAlive").OnServerInvoke = function(player)
	if 	player.Character:FindFirstChildOfClass("Humanoid").Health <= 0 then
		return false
	else
		return true
	end
end

function Abilities(titan)
	if titan:FindFirstChild("Abilities") then
		if titan:FindFirstChild("Abilities"):IsA("Configuration") then
			print('folder found')
			return titan:FindFirstChild("Abilities")
		end
	end
	return nil
end
function NukeIt(player)
	warn("Nuke!")
	local Sound = Storage:WaitForChild("Sounds"):FindFirstChild("Nuke",true):Clone()
	Sound.Parent = game.Workspace
	game:GetService("Debris"):AddItem(Sound,3)
	
	local Rumble = Storage:WaitForChild("Sounds"):FindFirstChild("GroundRumble",true):Clone()
	Rumble.Parent = game.Workspace
	
	game:GetService("Debris"):AddItem(Sound,3)
	TitanEvent:FireAllClients(player,player.Character,"Nuke")
	Sound:Play()
	Rumble:Play()
	
end
  
remotes:WaitForChild("PreShift").OnServerEvent:Connect(function(player,titanname)
	remotes:WaitForChild("Camera"):FireClient(player,"shake")
--[[
	local Fluid = Instance.new("Highlight")
	Fluid.Parent = player.Character
	Fluid.OutlineColor = Color3.new(1,1,1)
	Fluid.FillColor = Color3.new(1,1,0)]]
	local Debris = game:GetService("Debris")

	--Debris:AddItem(Fluid,50)
	local Tween = game:GetService("TweenService")

	local FluidP = {FillTransparency = 0}

	--Tween:Create(Fluid,TweenInfo.new(.5,Enum.EasingStyle.Sine,Enum.EasingDirection.In),FluidP):Play()
	local Titan = Storage:WaitForChild("Titans"):FindFirstChild(titanname,true)
	local Config = Abilities(Titan)	
	if Config  then
		if Config:FindFirstChild("Nuke") then
			local Theme = Storage:WaitForChild("Sounds"):FindFirstChild("Berthold_theme",true):Clone()
			warn('nuke')
			Theme.Parent = game.Workspace
			Theme:Play()
			task.delay(Theme.TimeLength - 1,function()
				repeat Theme.Volume -= .01 task.wait() until Theme.Volume <= 0 
			end)
			task.wait()
			NukeIt(player) 
			return
			end
		
	end
	if player.Character.Humanoid.FloorMaterial == Enum.Material.Air then
		remotes:WaitForChild("Effects"):FireAllClients(player,nil,"Bubble")
	else
		remotes:WaitForChild("Effects"):FireAllClients(player,nil,"Floor_Shift")
	
	end	
	
	
	
end)
remotes:WaitForChild("Shift").OnServerEvent:Connect(function(player,titanname)
	TitanModule.Shift(player,titanname)	
end)


remotes:WaitForChild("Unshift").OnServerEvent:Connect(function(player,prop)
	TitanModule[prop](player)
end)

local Physic = game:GetService('PhysicsService')

local HandCollision = "Hands"

Physic:CreateCollisionGroup(HandCollision)
Physic:CollisionGroupSetCollidable(HandCollision,HandCollision,false)
Editor is loading...