CCCPaste

Roles System

local RolesEvent = game.ReplicatedStorage.RolesEvent

RolesEvent.NormalKid.OnServerEvent:Connect(function(player)
	player:WaitForChild("Role").Value = "Normal Kid"
	player.Character.Humanoid.MaxHealth = 100
	player.Character.Humanoid.BodyDepthScale.Value = 0.7
	player.Character.Humanoid.BodyHeightScale.Value = 0.7
	player.Character.Humanoid.BodyWidthScale.Value = 0.6
	if (player) and (player.Character) then
		for _, Item in pairs(player.Character:GetChildren()) do
			if Item:IsA("Tool") then
				Item:Destroy()
			end
		end
	end
end)

RolesEvent.Protector.OnServerEvent:Connect(function(player)
	player:WaitForChild("Role").Value = "Protector 1"
	player.Character.Humanoid.MaxHealth = 100
	player.Character.Humanoid.BodyDepthScale.Value = 1
	player.Character.Humanoid.BodyHeightScale.Value = 1
	player.Character.Humanoid.BodyWidthScale.Value = 1
	local Bat = game.ServerStorage.SavedTools.Bat
	if (player) and (player.Character) then
		for _, Item in pairs(player.Character:GetChildren()) do
			if Item:IsA("Tool") then
				Item:Destroy()
			end
		end
	end
	Bat:Clone().Parent = player.Backpack
end)

RolesEvent.Medic.OnServerEvent:Connect(function(player)
	player:WaitForChild("Role").Value = "Medic"
	player.Character.Humanoid.MaxHealth = 100
	player.Character.Humanoid.BodyDepthScale.Value = 1
	player.Character.Humanoid.BodyHeightScale.Value = 1
	player.Character.Humanoid.BodyWidthScale.Value = 1
	local Medkit = game.ServerStorage.SavedTools.Medkit
	if (player) and (player.Character) then
		for _, Item in pairs(player.Character:GetChildren()) do
			if Item:IsA("Tool") then
				Item:Destroy()
			end
		end
	end
	Medkit:Clone().Parent = player.Backpack
end)

RolesEvent.Flashlight_Protector.OnServerEvent:Connect(function(player)
	player:WaitForChild("Role").Value = "Protector 2"
	player.Character.Humanoid.MaxHealth = 100
	player.Character.Humanoid.BodyDepthScale.Value = 1
	player.Character.Humanoid.BodyHeightScale.Value = 1
	player.Character.Humanoid.BodyWidthScale.Value = 1
	local Flashlight = game.ServerStorage.SavedTools.Flashlight
	local Bat = game.ServerStorage.SavedTools.Bat
	if (player) and (player.Character) then
		for _, Item in pairs(player.Character:GetChildren()) do
			if Item:IsA("Tool") then
				Item:Destroy()
			end
		end
	end
	Bat:Clone().Parent = player.Backpack
	Flashlight:Clone().Parent = player.Backpack
end)

RolesEvent.IceCreamBoy.OnServerEvent:Connect(function(player)
	player:WaitForChild("Role").Value = "IceCreamBoy"
	player.Character.Humanoid.MaxHealth = 100
	player.Character.Humanoid.BodyDepthScale.Value = 1
	player.Character.Humanoid.BodyHeightScale.Value = 1
	player.Character.Humanoid.BodyWidthScale.Value = 1
	local IceCream = game.ServerStorage.SavedTools:FindFirstChild("Ice Cream")
	if (player) and (player.Character) then
		for _, Item in pairs(player.Character:GetChildren()) do
			if Item:IsA("Tool") then
				Item:Destroy()
			end
		end
	end
	IceCream:Clone().Parent = player.Backpack
end)

RolesEvent.Fighter.OnServerEvent:Connect(function(player)
	player:WaitForChild("Role").Value = "Fighter"
	player.Character.Humanoid.MaxHealth = 100
	player.Character.Humanoid.BodyDepthScale.Value = 0.7
	player.Character.Humanoid.BodyHeightScale.Value = 0.7
	player.Character.Humanoid.BodyWidthScale.Value = 0.6
	local WoodenSword = game.ServerStorage.SavedTools.WoodenSword
	if (player) and (player.Character) then
		for _, Item in pairs(player.Character:GetChildren()) do
			if Item:IsA("Tool") then
				Item:Destroy()
			end
		end
	end
	WoodenSword:Clone().Parent = player.Backpack
end)

RolesEvent.Super_Protector.OnServerEvent:Connect(function(player)
	player:WaitForChild("Role").Value = "Protector 3"
	if player.Role.Value == "Protector 3" then
		player.Character.Humanoid.MaxHealth = 100
		player.Character.Humanoid.BodyDepthScale.Value = 1
		player.Character.Humanoid.BodyHeightScale.Value = 1
		player.Character.Humanoid.BodyWidthScale.Value = 1
		local Medkit = game.ServerStorage.SavedTools.Medkit
		local Bat = game.ServerStorage.SavedTools.Bat
		if (player) and (player.Character) then
			for _, Item in pairs(player.Character:GetChildren()) do
				if Item:IsA("Tool") then
					Item:Destroy()
				end
			end
		end
		Bat:Clone().Parent = player.Backpack
		Medkit:Clone().Parent = player.Backpack
	end
	player:WaitForChild("Role").Value = "PREMIUM"
	if player.Role.Value == "PREMIUM" then
		player.Character.Humanoid.MaxHealth = 100
		player.Character.Humanoid.BodyDepthScale.Value = 1
		player.Character.Humanoid.BodyHeightScale.Value = 1
		player.Character.Humanoid.BodyWidthScale.Value = 1
		local Medkit = game.ServerStorage.SavedTools.Medkit
		local Bat = game.ServerStorage.SavedTools.Bat
		if (player) and (player.Character) then
			for _, Item in pairs(player.Character:GetChildren()) do
				if Item:IsA("Tool") then
					Item:Destroy()
				end
			end
		end
		Bat:Clone().Parent = player.Backpack
		Medkit:Clone().Parent = player.Backpack
	end
end)